March 27, 2010

Create a Menu Button for your Homepage in WordPress

Originally, I had my WordPress settings set for my homepage to be static. I ended up changing my home page to be set to read my latest post and no longer be a static page. The problem that came up is wp_list_pages() returns links to your WordPress pages, but doesn’t return a link to your blog page with your recent posts. So, here is a small hack on how I got my homepage menu button to display.

<div class="menu_buttons">
    <li <? if(is_home()) echo 'class="current_page_item"'; ?>>
        <a href="<?php echo get_option('home'); ?>/">Home</a>
    </li>
    <?php wp_list_pages(array('title_li' => '')); ?>
</div>

Leave a comment