Don’t use the Genesis Blog Page Template

(Short answer: it’s not the main query, so customizations to the query won’t work. Make your blog the WordPress way, using Settings > Reading).

Genesis has been under development for quite a few years now. Given it’s history and large user base, there’s a few old features that would be removed, given the opportunity, but are needed for backwards compatibility – so people who have used them in the past can keep using them.

The biggest one (in my opinion) is the blog page template.

When you first install WordPress, your homepage lists your most recent blog posts. If you’d like a static homepage and to move your blog to a subpage, you can do so in Settings > Reading.

WordPress looks at specific files for these different pages. home.php is used for your blog posts listing (whether that’s your homepage or a subpage). front-page.php is used for the homepage of your site, whether you want blog posts or a static front page.

So, if you want a static homepage and your blog on a subpage like /blog, create the pages “Home” and “Blog”, go to Settings > Reading and set those as the appropriate pages to be used. If you’d like to create a template file to control the homepage, use front-page.php. If you’d like to create a template file to control the blog, use home.php.

Many of the older StudioPress child themes incorrectly use home.php for their static homepage. I’m not sure the reason, but my guess is they wanted to save people the step of going to Settings > Reading; when the theme was activated, the homepage was already a static homepage. The problem here is now you can’t have a blog. If you created a page and set it as the blog in Settings > Reading, it would use the home.php file which is now a static homepage.

Their solution to this was to create a page template that lists blog posts. The problem here is the blog posts are listed in a custom loop, not the main loop of the page (the main loop is the page’s content, which is replaced with this custom loop). This means plugins and other code that are designed to modify the main blog do not work.

What I recommend:
1. Never use the blog page template.
2. If you’re using a StudioPress theme that has home.php in it and it’s used for a static homepage, rename it to front-page.php. If you’re using one of the newer HTML5 themes, you should be fine. It’s only the older ones that have this issue
3. If you’re building a child theme for your client, exclude the Blog page template

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions

Comments are closed. Continue the conversation with me on Twitter: @billerickson

Comments

  1. Jason Weber says

    Bill, what are your suggestions if one is using the Dynamik Website Builder as a child theme?

    In this instance, the child theme mandates that you set your Settings >> Reading to show your latest posts — IF you want a static homepage.

    Because Dynamik’s EZ Home system won’t work if you set Settings >> Reading to a static homepage, it’s thus impossible to set your posts page to “blog” or whatever.

    Any suggestions or guidance in this regard would be greatly appreciated! Thanks!

    • Bill Erickson says

      I recommend you contact the creator of that theme and ask why they’re preventing core WordPress features from working. It sounds like they have just set up their theme incorrectly.

  2. Carla says

    Thanks for helping me better understand this.

    The two files (home.php and front-page.php) confused me since their names kind of mean the same thing to me. Changing home.php to home.txt removes the grid, but leaves behind full length posts.

    For the front page of the eleven40 Pro theme, I don’t want any blog content to display. I noticed the static feature in the Reading section and without having first seen your blog post, I added a Home page. But it’s kind of a blank slate.

    So you’re saying I can then use front-page.php to develop my front page? It’s confusing because I already created functions I want to use in the functions file, and yet they aren’t displaying when I use a static front page. I’m not sure how to approach this and would welcome some feedback.

    Thank you.

    • Carla says

      I wanted to add, I’ve always wondered about the static option in the settings. I prefer elegant solutions that really simplify the design process. This makes so much sense, and when my very curious client (mom!) starts poking around her dashboard, it will be a quick and easy explanation of why those settings are there.

    • Bill Erickson says

      Correct. If you use the Settings > Reading area to specify your front page and posts page, then home.php will be used for blog and front-page.php will be used for the actual front page.

      If you have code in functions.php you want to run on front page, make sure you use the is_front_page() conditional rather than is_home().

  3. Carla says

    Oh, it’s a conditional thing! Geesh, thanks so much for clarifying that.

    The eleven40 Pro theme has a page_landing.php file. Is that the same as front-page.php, or should I create a new file?

    I’m so grateful for your help, Bill!

  4. Carla says

    So I created a Home page and a Blog page, and changed the settings in the Reading section. The Home page is now my static front page.

    It wasn’t displaying any content until I realized I had checked the landing page template. To get the page to display correctly, I chose the default template. I had to change some conditional tags to get my widgets to show up, like you suggested, using ! is_front_page() || in my functions file.

    But I don’t understand what front_page.php does. How does my website know that my front page is now the new front_page.php file?

    Or could it still be using the default template I chose in the page settings? It must not be, because I used the conditional tag above to make my Solilquy plugin display on the front page, and it worked.

    I can never spell that word correctly.

    Anyway, I hope what I’m asking makes sense. Things are working great. I just don’t understand the new file I created. It’s blank aside from the simple code you gave me. Is the idea to use the default template, and if I want anything extra on the front page, I now have a choice. I can put it in the functions file or in the front page file?

    How is the default template file communicating with the new file? How do they know they are now married?

    Thanks!

  5. Carla says

    I forgot to change the Blog page template to default. When I did nothing was different, which is good. It works just fine.

    So this is what I’m talking about. It’s like magic, only I know it’s not. There’s some little wizard thing in the files that is telling all these pages who they are and what they’re supposed to do.

    I think my confusion is that you say blogs and static pages is a core WordPress function. But the default template is a Genesis file. Are they just calling into the house the core WordPress functioning by having that file? It’s not really a Genesis thing, but a WordPress call to action thing?

    :o)

  6. Marijn says

    Hi, thanks for this great post! I’m a bit of a noob so I have this question, hope it’s not a stupid one πŸ™‚
    Checked my theme and it’s using a front-page.php so not the home.php.. I selected my blog page and front page in settings-reading.. But still seems impossible to change the page layout for my blog page, in other words can’t have my sidebar to show up….
    Any idea what to do? Thanks so much in advance!

      • Marijn says

        Yes, you’re guessing correctly..
        Thanks for helping me out, it worked out fine! Gotta love the internet where people are still helping each other πŸ™‚ Keep up the good work!

  7. Jeremy says

    Hi Bill, as recommended, I’ve got my blog set up the WordPress way (I created a page called Blog and assigned it to the Posts Page at Settings > Reading).

    I recently decided to enable page titles on all my pages – previously I had them disabled via an option in my Genesis child theme, which I believe worked by removing the ‘genesis_do_post_title’ action, and I was then adding the titles myself as an H1 tag in the content of every page. But now I want the page titles added automatically by WP/Genesis itself, so that they get added before the ‘entry-content’ section begins, inside nice tags – ie. the Genesis/WP way of doing titles.

    However, I’ve found that the page title doesn’t get added for my blog page! Do you have any idea why not? My guess is that for some reason the ‘genesis_do_post_title’ action is not applied on the blog (ie. Posts Page) page, but I don’t know why not. Is there any way I can make this action run on my blog page?

    I realise that I can add a function like the one you’ve provided at https://gist.github.com/billerickson/9228933 to insert whatever content I’ve typed on my blog page, into the top of that page. But that’s not really what I’m looking for. I want to use the ‘genesis_do_post_title’ action, in part because I have another function which uses this action to manipulate my page titles, and I need that to be applied to my blog page too.

    Any ideas? πŸ™‚

    • Jeremy says

      Hi Bill – any chance you might be able to give me a reply or some pointers with my question above, please? πŸ™‚

        • Jeremy says

          Thanks Jon, but that’s not what I’m looking for. My Genesis child theme (Dynamik) already has the same functionality of the Genesis Title Toggle plugin built-in – I already can toggle page titles on and off from the Dynamik settings, exactly the same as what that plugin does. The problem I have is that the page title doesn’t get added for the Posts Page, ie. the page assigned as such at Settings -> Reading, which is what Bill is recommending we do in his article here. (I just installed the Genesis Title Toggle plugin just now to check it out anyway, but it doesn’t resolve this).

          I think the problem is that the Posts Page is not considered to be the same as a regular page as far as the β€˜genesis_do_post_title’ action is concerned, and so that action is not triggered against the Posts Page. I’m hoping there’s a way to change that.

          • Jon Brown says

            Correct. Title Toggle won’t help you. Sorry to lead you astray I misunderstood what you wanted.

            I have no idea how Dynamik works. You should probably contact their support.

            In a normal Genesis Child theme though you should be able to add this:
            add_action(‘genesis_loop’, ‘genesis_standard_loop’, 6);
            to page_blog.php or whatever template you’re now using for your blog (home.php perhaps) it’ll output page title and content before the archive.

          • Bill Erickson says

            As you’ve figured out, the Posts page isn’t actually a “page” when it comes to WordPress.

            Pages are a type of singular content, like individual posts, or a single event if you have a custom post type called Events.

            WordPress also has dynamic archives, which list singular content. The blog posts page lists the most recent posts. A category archive lists recent posts in a specific category. Etc.

            When you specify a page to act as the Posts page, you’re really telling WordPress “when you visit this page, don’t treat it as a page. Treat it as a dynamic archive, listing my most recent posts”. So the content you enter in Pages > Blog is not shown.

            To fix this, open your home.php and place something like this (without the https://gist.github.com/billerickson/cbcaf51b25bbae30cea7

          • Jeremy says

            Thanks for your replies. @Jon, I *do* know how Dynamik works, and this is definitely nothing to do with Dynamik – it’s a Genesis issue. Also, adding the “add_action” entry that you referenced to the home.php template file, does not work when the blog posts page has been set at Settings > Reading, which is the method recommended by Bill in this article. πŸ™‚

            @Bill, your Gist isn’t quite right I’m afraid – I tried it, but it inserted the title and content of the first post itself into the top of the Blog page, rather than the title/content of the Blog page itself! πŸ˜‰

            However your Gist got me going in the right direction, and I’ve ended up with the following instead, which works just fine:
            https://gist.github.com/GermanKiwi/3ca2dd08a35d615e138c

            Do you think I’ve written that the best/most optimal way, or do you have any suggestions to improve it? (I’ve changed the class names to suit my own theme’s existing styling).

  8. Chris Reed says

    So the child-theme I am currently working in has a front-page.php but doesn’t have a home.php for the blog page. So should I create a home.php for the blog page so I don’t have to use the page_blog.php template.

    I see how there can be a problem since some of the conditionals I’d like to use on the blog page don’t really work using the blog page template.

    Thanks for the great post!

    • Bill Erickson says

      You don’t need a home.php file. WordPress uses the template hierarchy to determine what template to use for certain pages. It’s similar to how you don’t need a category.php file to have a category archive page. It will just look at archive.php, then index.php.

  9. Chris Reed says

    I changed my Settings>Reading settings and everything is working great for the most part. I had one small issue where my front-page.php was checking for is_home() and was causing some issues, but adjusting the conditional it to is_front_page() worked great.

    The only problem I’m having now is that my front_page.php uses the genesis_grid_loop() function to display recent posts on the home page. When I set the static home page to ‘Home’ instead of displaying the recent posts, it is just displaying a link to the page ‘Home’. Any idea whats going on there (screenshot below)?

    Thanks for the great post.

    https://www.dropbox.com/s/t67sp3qbkieamti/Screenshot%202014-08-15%2015.39.01.png

    • Bill Erickson says

      I’d have to see the code in front-page.php to figure out what’s wrong with it.

      • Chris Reed says

        I think it most likely has to do with the Genesis Grid Loop on the front page. It seems that for some reason when a static page is set to the home page the grid loop wants to return the static page instead of the latest posts.

        ~~~~~~~~~
        //* Add widget support for homepage if widgets are being used
        add_action( ‘genesis_meta’, ‘minimum_front_page_genesis_meta’ );
        function minimum_front_page_genesis_meta() {

        if ( is_front_page() ) {

        //* Remove entry meta in entry footer and Genesis loop
        remove_action( ‘genesis_loop’, ‘genesis_do_loop’ );

        //* Add Genesis grid loop
        add_action( ‘genesis_loop’, ‘minimum_grid_loop_helper’ );

        //* Genesis grid loop
        function minimum_grid_loop_helper() {

        if ( function_exists( ‘genesis_grid_loop’ ) ) {
        genesis_grid_loop( array(
        ‘features’ => 0,
        ‘feature_image_size’ => 0,
        ‘feature_content_limit’ => 0,
        ‘grid_image_size’ => 0,
        ‘grid_content_limit’ => 750,
        ‘more’ => __( ‘[Read more]’, ‘minimum’ ),
        ) );
        } else {

        genesis_standard_loop();
        }
        }
        ~~~~~~~

        • Bill Erickson says

          genesis_grid_loop() and all the other *_loop() functions in Genesis are designed to operate on the main query of the page. When you’re on a static homepage, that main query is the page called Home.

          Try adding ‘post_type’ => ‘post’ to your arguments. Not sure if it will work, but it might.

          If it doesn’t, just build your own custom query. I think that’s much easier than using grid loop Genesis provides.

  10. Odell McCants says

    Thanks for this article. After finally setting up my site, I’m struggling with what I thought would be the easiest part – getting my posts to show on my blog page. I’m still not quite clear as to how to get this done. Here is my current setup:

    I have a static home page
    I have a page titled Blog/Podcast
    Blog/Podcast is set to “Default Template” (changed from blog template after reading this)
    Under Settings > Reading, Front Page is “Home” and Posts Page is “Blog/Podcast”
    What appears on the blog page are the sample blog posts that loaded with the theme and not my post I created.

    What do I need to change?

    • Bill Erickson says

      Only posts that are created in the backend will appear in your blog. Did you import the sample posts? Go to Posts in the backend and delete the posts you don’t want displayed.

      • Odell McCants says

        Thanks Bill. I can’t believe creating blog posts has been the hardest part of this process for me.