Posted on 16 September, 2010 By 45 Comments

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 - Free Yourself from Accounting

Keep Reading:
Posted In : WordPress Tips

Did you enjoy this article? I can assist you with your WordPress or Facebook project. Contact me and I will provide you with an estimate. You can also connect with me on Facebook or follow me on Twitter. If you are looking for Hosting, WordPress Theme, Newsletter or other recommendations, please view my detailed list.

45 Responses to “How to Include a Post on a WordPress Static Front Page with the Thesis Theme”

  • I stopped reading when you answered my question in the 3rd paragraph.

    i will be back to talk to you about doing this on a non-thesis theme.
    Dennis Edell @ Direct Sales Marketing´s last post ..FREE Copy of a 50-page Jimmy D Brown Course download now

  • 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?
    Henway´s last post ..Should I drink soda when dieting

  • 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!
    Kristina´s last post ..FusionHQ Is Re-Opening!!

  • 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.

    • 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)

  • 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.
    Bill Gassett´s last post ..How to Interview a Realtor With Great Questions

  • 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.
    bryan bliss´s last post ..How to Get Customers and web traffic from Local Search

  • 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=””>

    • 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.

  • 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?

  • 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.

    • 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.

      • 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.
        karen´s last post ..What happened to all those letters you sent about the GE salmon

        • 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…
          Rob´s last post ..Mobile Website SEO Tips

  • 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!

  • 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
    Stephen Cobb´s last post ..Coffee- Tea- Fe The truth about meal-time iron absorption

  • 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!!

  • 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!

  • 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.
    J. Alan´s last post ..Corona Short Sales The short sale ratio in Corona- CA

    • 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.

      • 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 :-)
        J. Alan´s last post ..Corona Short Sales The short sale ratio in Corona- CA

  • 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.
    Bill Gassett´s last post ..Home Buying Tax Deductions

Leave a Comment
You may use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .

CommentLuv badge


Kim Woodbridge is an accomplished Information and Technical Consultant specializing in the entire implementation of a WordPress based website including installation, theme design, upgrades, unique customizations and ongoing site maintenance.

Recent Comments

    • Tanya: These are some great plugins! Will have to try a few out, Thanks :) Love that its free too!...
    • Gary Starkman: I wonder if there are gonna be any new posts, I'm a big fan of posts like this one, really is helpful....
    • Raviraj: I am a big fan of woocommerce.. I have installed in many of my websites.. Glad to see these awesome free woocommerce ext...
    • Gary Starkman: Thanks for sharing, put a smile on my face....
    • vaibhav: I have a friend with one. This might help him. Il ask him to contact you...

Wordpress Services

  • Installation, upgrades and maintenance
  • Conversion of existing html and css templates
  • Theme and plugin recommendations
  • CSS customizations
  • Troubleshooting and tweaks for unique situations
  • Customization for individual blogging goals and needs
  • Training and advice