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. Carla says

    Hi Bill . . .

    Just a follow up question.

    With your help I successfully made the front page its own page and set it to static. Below the banner widget I created, I am seeing Home (the page title) and some blank space. This is expected from a page, but I’m only using widgets for the front page and would like to remove that section.

    I can set .site-inner to display as none, but that removes it from every page. Is there a more elegant way to do this?

    Many thanks!

    Carla

    • Bill Erickson says

      If you don’t want the homepage content to render, place this in your front-page.php file: remove_action( 'genesis_loop', 'genesis_do_loop' );

  2. Michael Gordon says

    Hey Bill – Just came across this awesome post.

    I have my Reading settings as follows:

    Front page displays: A static page.
    ——–> Front page: Home
    ——–> Posts page: Blog

    When I’m on the Edit Page screen of my Blog page and I click the “Preview Changes” button to the right, the URL that’s displayed looks like the blog page i.e. domain.com/blog/…

    http://domain.com/blog/?preview=true&preview_id=551&preview_nonce=f27379bf88

    BUT the actual page content that is displayed on screen is that of my Home page (i.e. the Front page) found on the public page domain.com. Is this ‘normal’ behavior?

    Prior to reading this post (as a non-coder) I would have expected that clicking the Preview Changes button on the Blog page would display the Blog page (seems logical) – not the Home page (seems illogical)… but now I’m wondering if this seemingly illogical behavior I’m experiencing is actually the normal behavior for WordPress given my Reading settings. (Note that I’m not using Genesis in case relevant).

    Appreciate your comments as to whether this is indeed ‘normal’ or if this indicates some sort of problem going on.

    Thanks!

    Michael

    • Bill Erickson says

      It might be a bug in WordPress itself. I created a blank WordPress site, created a Home page used for home and a Blog page used for posts, and previewing Blog showed me the Home page.

      But I’m curious, what’s your use case here? Preview only works before a post/page is published. After it is published, preview just shows you what’s already published. I can’t think of an instance where I’d preview the blog page, or any published page for that matter.

      If I post this on WordPress’ bug tracking site, I’ll need some details on what the expected outcome is and why you’d want to do that.

      • Jeremy says

        FWIW, I just tested this and experienced the same “bug”: getting my home page when I hit Preview while editing my Posts Page.

        Bill, I’m not sure I agree about how the Preview button is supposed to work, though. πŸ™‚ For me at least, the Preview button works just fine for pages that are already published (other than the blog page as noted here).

        So if I go to “Edit” an already-published regular page, and make some changes, and hit Preview, I get the special preview URL (with all the parameters at the end of the URL), and it shows the unpublished changes I’ve made. I assume that’s the intended outcome, and it’s certainly a very useful feature, to be able to see how changes will look on a page before I click the Update button to publish those changes.

        • Bill Erickson says

          Hmm, that’s interesting since you can’t save a “draft” of a published page. The auto-draft functionality must be running on published pages as well. I guess I haven’t tried that before.

        • Michael Gordon says

          Bill,

          As per Jeremy’s comment: “…and it’s certainly a very useful feature, to be able to see how changes will look on a page before I click the Update button to publish those changes.”

          This is exactly my use case for the Preview Changes button. I find it particularly useful for the Blog page during the initial site development, so that I can play around with different layouts, etc. and preview them without having to hit Publish each time.

          Interestingly, upon some further research I found what appears to be (thus far) a solution to the ‘bug’ of WordPress displaying the homepage content when previewing the blog page:

          In Reading settings, I set my Posts page to ‘blank’ (i.e. – Select -) – not Blog… and all seems to be working as expected now: Not only can I now preview my blog page, but changing the Reading setting to blank also appears to have resolved another (seemingly) related issue I was having with my XML sitemap in Yoast WordPress SEO.

          My Blog page was showing in both my ‘Page’ sitemap and my ‘Posts’ sitemap – but it should be appearing in my Page sitemap only; now it does.

          Thus far I haven’t seen any issues with leaving the Posts Page set to blank, but if I find anything I’ll let you know. Keep in mind that for this particular site I’m not using Genesis; I’m using Divi Theme by Elegant Themes (in case that matters).

          Thanks again Bill, and Jeremy.

  3. Dave says

    Hi Bill,
    Here’s a slightly obscure case for your possible amusement.

    I have a custom field to show a bit of content on a Pages or Post above the loop. It works just great, except when I designate a static Page as the Posts Page (i.e., the standard WP setting for that). However, if I do choose the Genesis Blog Page Template, it does show up. This is whether I use stock get_post_meta or the proprietary genesis_get_custom_field.

    Ciao, Dave

  4. Ken says

    Does this apply only to older Genesis child themes or to them all. If all, is this why I can’t have a custom sidebar on my blog page?

    Thanks

  5. Hamayon says

    Bill I’ve heard a lot about the genisis and a lot of friends of mine are very proud to use genisis framework on all of their blogs but seriously I have never liked it and never use it. Thanks to you for your this blog post, now I will never use it πŸ™‚

    • Bill Erickson says

      I’m sorry you interpreted my post that way. In my opinion Genesis is the best theme framework on the market, and it’s what I build all of my clients’ sites on. This post does not discourage the use of Genesis, simply recommends you don’t use a particular feature that’s there for legacy reasons.

  6. Mark Hemmingson says

    Hi Bill – Thanks for this post. I’m a little late to the party but I just want to clear up my fuzziness around the blog page.

    I have an HTML5 child theme, Magazine Pro, with a front-page.php. This is how I set it up, which seems to work fine.

    Reading >Settings: Static Page
    Front Page: Home… This causes front-page.php to be called as the Front Page of my site.
    Posts Page: Blog… I created a page, called it Blog, and used the default template. This causes my Blog Page to work in the WP way, using standard WP hierarchy.

    So, now if I want to alter my Blog output I could copy the home.php from Genesis, paste into my child theme, and make all changes in the new home.php in my child theme.
    Is that correct?

    • Bill Erickson says

      Almost! You don’t need to copy any files from Genesis. Just create a file in your child theme called home.php with the following in it: https://gist.github.com/billerickson/bf4224fd29a55433269d

      You can then add whatever you like to change above genesis();

      Genesis doesn’t have a home.php file. Instead of specific template files, it just loads the genesis() function which then runs through all the hooks. So when you’re creating template files in your child theme you just create a file with genesis() in it and then add your additional code. This way you don’t have to worry about your custom template files getting out of sync with Genesis

  7. Chris Mower says

    Hi Bill,

    First off, thanks for all your great content. I wanted to just chime in here (although I’m a little late to the party), but I noticed that one of the benefits to using the Genesis Blog page template instead of WP’s default ‘Settings > Reading > Posts page’ setting is that it allows users (clients specifically) to exclude categories by ID via the ‘Genesis > Theme Settings > Blog Page Template’ option without having to get into the code and risk blowing things up, so to speak.

    As far as I’m aware, the only way to exclude categories otherwise is to write a function to do so, and then if a client ever adds new categories or whatever else, you have to go in each time and alter the function.

    Do you have any thoughts on that?

    Thanks.

    • Bill Erickson says

      Out of the box, no, there’s no way to exclude categories from the blog without writing code or using a plugin.

      The simplest option (in my opinion) is to edit your theme’s functions.php file and customize the query. I’m sure there’s a plugin out there that will do this for you as well. It doesn’t need to be Genesis specific since the blog page is a core WordPress feature.

  8. Paula G says

    Interesting post to read here. I recently inherited a site to maintain. The client has the Home Page with the latest blog posts and also has a Blog page with latest posts. They are separated out because she wants a different sidebar on the home page than on the blog page.

    This is using Genesis and eleven40 child theme
    To accomplish this The Blog page is the “recent posts” page in settings and uses the blog template
    The home page is a page using the blog template and the “Home” in settings is set to this home page.

    It all works fine EXCEPT the previous/next links do not work on the home page (they do work on the blog page) – because WordPress generates the Previous/Next links and must have it set with a /blog within the URL. The home page is missing that and thus the links fail.

    I am pulling my hair out a bit trying to find an easy programmatic solution to this. Do you have any thoughts?

    • Bill Erickson says

      Personally I would create a custom page template for the home that lists the posts, and instead of having pagination at the bottom have a button that says “Read more in our blog” which takes you to the actual blog, or page 2 of the blog.

      A simpler but less clean way is to use the setup you currently have, then conditionally remove the pagination from the front page, then hook a function after the loop to display the button (both of these from functions.php since you don’t have a template in your child theme for the homepage).

  9. Chad Williams says

    Hi Bill, great info.

    My question piggy backs off this post and since you made the Title Toggle plugin I’m sure you have the answer.

    So I’m displaying the blog page using WP and not page_blog.php. The client however wants the h1 for this page to be visible. How would you go about doing this?

  10. Jordan Smith says

    Hey Bill,

    I’ve started following your recommendation here but noticed that I have to also set a “Home” Page or the blog shows up on the home page instead of the content being output by front-page.php.

    This isn’t that big an issue in an of itself but I noticed when I do this the home page logo gets downgraded from an tag to a tag by genesis because it’s now serving a page. Is there a way to force the tag for the home page if using an actual page? Thanks man!