Hi
what is the best way to get something like this achived with Enfold?
<?php
if (in_category(array(1)))
{include(TEMPLATEPATH . '/includes/single-book.php');
}
elseif (in_category(array(84)))
{include(TEMPLATEPATH . '/includes/single-techs.php');
}
else
{include(TEMPLATEPATH . '/includes/single-else.php');
} ?>
1: Creating Child-theme
2: having a single.php in my child-theme
3: putting the code above in the single.php
4: having a directory called “includes” in my child-theme
5: in this directory i put copies of the original “single.php”, rename them and edit their content as i need
Is this the correct way for Enfold or do you recommend another way?
Please keep in mind that we need to keep compatibility with future versions of enfold/wordpress
Kind regards arthur
Hey Hooge-AGS,
Yes, this is the recommended and correct way to include custom templates. However I’d use the get_template_part() function ( https://developer.wordpress.org/reference/functions/get_template_part/ ) instead of include().
Best regards,
Dude
Hi Peter
i changed the code now to “get template part” and it seems to work.
But my tool “Query Monitor” tells me always i am on “enfold-child/single.php”
This is wrong since this is only the place where the query is tweaked/splitted.
Do you know a tool thats shows me which template part is used?
kind regards arthur
SOLVED this part