Site logo

Archived topic

customizing generate_do_template_part

1 reply · Started by eric on March 3, 2022

Viewing posts 1–2 of 2

Hi there,

I'm trying to modify the titles and featured image by making changes to the code that is called by this line:

generate_do_template_part( 'single' );

I've read posts like https://generatepress.com/forums/topic/generate_do_template_part-vs-custom-template-in-child-theme/ and would like to pull up my own template. I would like to use a command like this

generate_do_template_part( 'single-landingpage' );

to pull up a copy of the single.php file named 'content-single-landingpage.php'

The issue is that it this comamnd is not accessing the file. Could you let me know what I'm doing wrong? Thank you in advance.

Hi Eric,

Is your landing page a static page?

If so, you need a copy of content-page.php and page.php, then rename them to eg. content-home.php and page-home.php (I assume homeis the slug of your landing page)

Then replace this line generate_do_template_part( 'page' ); in page-home.php with get_template_part( 'content','home' );

Let me know if this helps :)

This archived topic is closed to new replies.