How to Include a Post on a WordPress Static Front Page with the Thesis Theme

I work with the Thesis theme for WordPress quite a bit but I don’t think I’ve written about it before. It took me a bit to figure out how to add a post to static front page so I decided I would document what I learned.

My client wanted a static front page and then for the blog to be on a different page. No problem there – that’s managed by a WordPress setting under Settings > Reading. But she also wanted the most recent blog post on this same static page.

When working with other themes I would create a custom page template and assign that to the page that is the static front page. The custom template would be very similar to the page template but also contain a custom query to pull the most recent post and other custom elements.

This, however, is different in Thesis and I haven’t quite figured out how to do it. With Thesis, it’s easier to write a function and use an action hook. Often, you can find a function that already does what you need and don’t need to write one of your own. I could not locate an appropriate example but it’s also possible I wasn’t searching correctly – I was a little tired while working on this. I think I was also being a little lazy because I knew the code already. Anyway …

The Function and Hook

  1. Add the following to the custom functions file under Thesis > Custom File Editor in the WordPress Admin.

    function custom_homepage() {
    if (is_page(‘about’))

    { ?>

    <?php query_posts(‘showposts=1’); ?>
    <?php while (have_posts()) : the_post(); ?>

    <div class=”post_box”>
    <h1><a href=”<?php the_permalink(); ?>”>
    <?php the_title(); ?>
    </a> </h1><br />
    <div class=”format_text”><?php the_excerpt(); ?></div>


    <?php endwhile; ?>

    <?php wp_reset_query(); ?>

    <?php }
    add_action(‘thesis_hook_after_content’, ‘custom_homepage’);

  2. Change if (is_page(‘about’)) to the name of the page you set as your static front page. In this example the front page is called ‘about’.
  3. query_posts is pulling 1 post to this page. You can set this to a different number. You can also set it to only pull posts from a particular category by adding category_name. Here is an example of a query that pulls posts from the wordpress category and shows the last five posts.


  4. This example has the post title, which is linked, and the excerpt. Changing

    php the_excerpt();


    php the_content();

    will give you the full post.

  5. div class=”format_text” is the class used by Thesis to style the content of the posts, which is why it is included in the function. If you wanted to style the post differently, you would add a new class to the custom style sheet under Thesis > Custom File Editor.
  6. wp_reset_query clears the query so you don’t get odd results on the rest of your page. It’s hard to explain what might happen but if you saw it, you would know there was a problem. For example, you might have the post you are pulling, a duplicate of it and none of the content that is supposed to be on the static page.
  7. add_action(‘thesis_hook_after_content’, ‘custom_homepage’); – this adds the hook that will display your function in the appropriate location. thesis_hook_after_content is saying to place the function after the static content on the front page. You could also use thesis_hook_before_content, if you wanted it to come before the static content. A list of Thesis hooks is available on their website.

If you use Thesis, I hope you found this useful and I hope you were excited as I was about my first Thesis post;-)

Note: the link to Thesis themes at the top of the article is an affiliate link.

photo credit: denn

It's Time!

Start your development project now!

Contact Me! >>


Keep Reading:
3 Ways to Add "Dummy" Content When Developing a WordPress Site
How to Add Custom Taxonomies to Your WordPress Theme
How to Make a Navigation Item on a WordPress Custom Menu Open in a New Window
Add Extra Classes to the Body Tag in WordPress with the Ambrosite Body Class Enhanced Plugin


  1. says

    Thanks a lot for the info. I’ve been using mostly Cutline as my WordPress theme, and wondering if you could do a post on doing this for Cutline?

  2. says

    Hey Kim,

    Thanks for the great post! it has been impossible to find any other information to do this simple little function.

    I’ve actually tried your custom function and have had a bit of a problem. Even if I paste the code exactly as you have it, I get the following error:
    Parse error: syntax error, unexpected T_STRING
    This is on the if (is_page(‘about’)) line.

    I don’t suppose you know why this is…?

    Any help you could offer to fix this error is greatly appreciated!

    Thanks in advance!

  3. Neil says

    In paragraph 3, you mention creating a custom page template similar to the page.php and assigning it as the static front page, then adding a query which shows the Blog post. Can I add a query which lists all the Blog posts, in standard reverse chron order? Thereby creating a front page with both static text (editable in the Page editor, instead of editing the front page static text by editing the home.php file) and the Blog entries.

    • says

      Hi Neil – The query needs to go on the template but you can still have standard text on the page via the editor, which will also be displayed. The layout will depend on where the different parts of the code are on the template.

      Posts can be in reverse order

      order=ASC – show posts in chronological order, DESC to show in reverse order (the default)

  4. says

    Thesis is just an awesome platform. You certainly will have a hard time beating this theme for SEO which of course is very important for online rankings.

    • says

      Hi Bill – From a coding perspective it’s not my favorite theme to work with. A lot of clients use it, though, so I’ve had to learn how to get better at customizing it.

  5. says

    this is cool news to find but alas came too late for me.
    I needed to execute this function for a client of mine and found the whole exercise confusing enough ( before i found your solution that is) that i ended up talking her out of the option.
    thanks for clarifying and providing what looks to be a useful option Ill keep in my brain. im curious which platform you DO like the most, from a coding perspective.

    • says

      HI Bryan – Too bad it came too late :-) At least you were able to workaround it. You must be persuasive – very rarely can I talk my clients
      out of anything ;-)

  6. TrishaG says

    Hi Kim,
    Thank you for a detailed tutorial. It was easy enough for a newbie like me to follow along. Here’s my question: I’m using thesis, and on my test site I tried your code on my static page named home, and I changed the function to reflect that. No post showed up on the home page after I refreshed the page, I set the function to show 3 post after content. Am I missing something?

    Also all post titles in Thesis are h2. should this part of your code also be h2? instead of h1?

    <a href=””>

    • says

      Hi – It sounds like it’s not understanding which page so the function isn’t doing anything. Is the name of the page home or something else? If you’re not getting an error the code is setup properly but it isn’t sure what to do.

  7. George says

    Hey, first of all this is really cool. I like it just how it is, but How can I get the byline to appear and not just the title?

  8. says

    I have a couple of questions….

    I recently created a static page thinking it will be a good portal for the rest of the site, blog, shops, tips, etc…

    But then, I feared that SEO would be affected since there are no content attached to the front page. Do you know if that’s true of does the spider know to crawl other pages as well for rankings?

    Second question is what would be the benefit of adding a blog post to the static page if you are trying to separate your blog from the static page? Do you have a site as an example I can look at?

    Thanks as always Kim for great tutes.

    • says

      Hi Karen,

      I’m far from an expert on SEO. The entire site, however, will be indexed – not just the front page. So, if the blog isn’t on the front page the updates will still be noticed. I have a site that doesn’t have a blog on the front and it seems to do fine.

      I’m not sure if there is a benefit to putting a post on a static page other than to have fresh content or make the visitors aware that there is a blog. I did this for a client who wanted to do this.

      The top box with the blue border is the most recent post.

      • says

        That’s good to know that spider crawl the entire site and thanks for the link to your client.

        I’m still debating whether to put a post on my front page or not. i kinda like the clean look with links.

        I have to sleep on it.

        I also want to put the two boxes next to each other…if I can figure out how.

        Thanks again.

        • says

          I was actually looking for a plugin to handle this, but the coding seems simple enought. I’m using a different theme, though. I suppose I can clone the page and add the needed code, along with the appropriate css info… trial and error it will be, but I’m sure it’ll work out….

          I thought about using a widget to pull the RSS feed into the homepage’s side bar, like Acme Related RSS, in which you can specify how many characters to publish…

  9. James says

    Thanks for the awesome tut! Exactly what I needed.

    I wondered if you might be able to tell me how get the comments and ‘add comment’ box to display beneath the post?

    Thanks again!

    • says

      Hi James

      I don’t have anywhere to test this right now but I think the comments template could be pulled it with

      <?php comments_template(); ?>

      after the excerpt part of the code.

      • James says

        Thanks for the reply Kim. I tried inserting that line where you suggested but it didn’t work.

        Any other ideas?


  10. says

    Great post Kim — A big help to me. I am slowly building out a number of Thesis-based blogs. It is a powerful platform but with all that power it can be hard to find the basic instructions.

    You did a great job describing this problem and your solution (and answering so many questions).

    Thanks again…Stephen

  11. says

    Hi Kim – you are the only person on earth that I could find who knows how to do this. Now I just wish I could get it to show up where I want on the page instead of before this or after as I’m limited by hooks. I really appreciate you sharing this and just want to say thank you!!

  12. Laura Poindexter says

    I had a little trouble with a parsing error but once I put your block of code in front of all the other hooks I used in the custom_functions.php file, it worked fine. Thanks!

  13. says

    Hey Kim,

    This is an excellent post and tutorial; exactly what I was looking for! I just wanted to point something out. In your code you have the permalink wrapped in an tag and the quantity of posts set to 2. Assuming someone already has an tag in their static content (as they should) this scenario would give them 3 tags, which is not good for SEO. That tag should probably be changed to an . Anyway just thought I’d contribute. Again, great post and thanks for the help.

    • says

      Hi – The number of posts is set to 1 not 2. And by tag do you mean the h1 tag? The title is the permalink and in the original code it was an h1 tag – do you mean there would be multiple heading tags on the front page? Otherwise, I’m not clear on what you mean.

      • says

        My bad Kim,

        The original post should have read:

        This is an excellent post and tutorial; exactly what I was looking for! I just wanted to point something out. In your code you have the permalink wrapped in an H1 tag and the quantity of posts set to 1 (the bare minimum). Assuming someone already has an H1 tag in their static content (as they should) this scenario would give them two H1 tags and even more if they set the posts to return higher, which is not good for SEO. That tag should probably be changed to an H2 . Anyway just thought I’d contribute. Again, great post and thanks for the help.

        In my original post I put the H1’s and H2’s in brackets so they didn’t show up :-)

  14. says

    I have both a Thesis them blog as well as Genesis. They are both outstanding for SEO. In fact if you are blogging I don’t think there is anything better out there. I have been to some truly great sites but then you realize the owner has done nothing to optimize their site so their content does not get great exposure.

Comments are closed. Please contact me for specific questions or subscribe to my newsletter.