Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #988379

    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

    #988385

    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

    #1017558

    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

    #1017578

    SOLVED this part

    • This reply was modified 5 years, 9 months ago by Hooge-AGS. Reason: solved it myself
    #1017731

    Hi,

    Thanks for the update, I’m not sure if you need any further help on the topic though?

    Best regards,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.