• I currently have a file in my theme “content.php” which is being used to display my blog posts. I have created a copy of the page and named it “content-blog.php” but am unsure of how to instruct my wordpress installation to use this modified page instead of the old.

    I know for pages there is an option on the right hand side in which you can pick the page template based on the name given in the comments at the top, but do not see a similar option for posts.

    How can this be accomplished?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Have you added Template Name: Your template name at the top of content-blog.php?

    Thread Starter d.lanza38

    (@dlanza38)

    I have tried adding that to the template file “content-blog.php” but I only get the option to use that template on my pages and not for displaying my posts.

    https://codex.www.ads-software.com/Template_Hierarchy

    what theme are you using?

    content.php is usually (at least in the default themes like Twenty Fourteen) called by one of the default templates (more as just a part of the output, not really the controlling template).

    Ah yes. That only works for pages.

    To do the same for *posts* there is a plugin called single post template. https://www.ads-software.com/plugins/single-post-template/

    Thread Starter d.lanza38

    (@dlanza38)

    @alchymyth, So the template pages which is used for display blogs is called from within the theme code? I’ll search my files for anything with content.php and see what files come up in the results.

    @dfunkydog I will also look into that plugin. While in this instance I would want all posts to use the same template, it may come in handy being able to choose different post templates on the fly.

    I *think* the file you want to customise is single.php this is the template that wordpress uses to display blog posts.

    In some themes single.php may include content.php as part of the page.

    In other words in most themes, blog posts uses single.php as the template which in turn calls (header.php, content.php, sidebar.php footer.php)

    Thread Starter d.lanza38

    (@dlanza38)

    Ahh, thank you for all of your help.

    I had a line in my single.php <?php get_template_part( 'content', get_post_format() ); ?> which I then changed to <?php get_template_part( 'content-blog', get_post_format() ); ?> and now I am using the intended template.

    I am now 1 step closer to become a WordPress guru ;-D

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Dictating which (post) page template to use’ is closed to new replies.