![]() |
Hi,
I'm using this code:
... to pull in a template file, no problems here. But now I would like to include a specific template file based on a custom field value. This is the code I use to output the custom field value: So what I would like to achieve is to have the template id value attached to the file name. Something like this: That way the user could for example make a selection of which template to be included. I'm getting the following error with the above code: syntax error, unexpected T_ECHO Your help is much appreciated. Thanks! Solution - 1Use instead Solution - 2try this Solution - 3Just remove the echo keyword. Use this Solution - 4You don't need to use echo. Solution - 5try this Solution - 6there's WordPress native function for including templates which has the advantage of first looking in child theme first if there is one, which means you can override the parent theme. get_template_part('/path_to/template.php'); or get_template_part('loop','home'); // looks for loop-home.php http://codex.wordpress.org/Function_Reference/get_template_part |
Wordpress |
Type: | Code Example |
Category: | Coding |
Sub Category: | Code Example |
Uploaded by: | Admin |
Views: | 8 |