Adding the index.php (blog) page to the default menu on a thematic childtheme

By default, a thematic childtheme will show all your pages except the standard dynamic index.php. This doesn’t matter if you are using a static home page – you get exactly what you would expect, links to “home”, “blog”, and any other pages you have added.

If, however, you are using the home page to display your blog entries, thematic assumes that it is enough to be able click on the blog title to get you back there if you wander off elsewhere on the site. Sometimes this is fine, but I like to add a link to “home” too, partly because I think it is good practice to have a really obvious way to navigate to the home page of any site, and partly because if you have a really simple blog, with only the blog page and an about page, it looks a little naff to just have one page link…

Fortunately, as with most things, Thematic and WordPress between them make it really easy to do this. Just add the following to your functions.php file:

// I want the home page to appear as a link in thematic_access
// First remove the standard thematic function
function remove_thematic_actions() {
 remove_action('thematic_header','thematic_access',9);
}
add_action('init','remove_thematic_actions');
// Recreate the Thematic Access with home (blog) page included
function childtheme_page_menu() { ?>
 <div id="access">
 <div><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div>
 <?php wp_page_menu('show_home=1&sort_column=menu_order') ?>
 </div><!-- #access -->
 <?php }

add_action('thematic_header','childtheme_page_menu','9');

For more ways to customise the navigation see the WordPress function reference for wp_page_menu() and the Themeshaper article on WordPress menu tricks

This entry was posted in Thematic, Wordpress and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>