views:

47

answers:

3

Hi all,

I'm working on a Sandbox based Wordpress theme and I would like to add a home link as a first item in the navigation. I know I should change the function in "sandbox_globalnav" in the functions.php file, which is:

// Produces a list of pages in the header without whitespace
function sandbox_globalnav() {
if ( $menu = str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages('title_li=&sort_column=menu_order&echo=0') ) )
    $menu = '<ul>' . $menu . '</ul>';
$menu = '<div id="menu">' . $menu . "</div>\n";
echo apply_filters( 'globalnav_menu', $menu ); // Filter to override default globalnav: globalnav_menu

}

However, my PHP skills are really basic and I'm not sure where I should override this.

Thanks!

+1  A: 
<li>
   <a rel="<?php _e("bookmark"); ?>" title="<?php _e("Home"); ?>" href="<?php bloginfo('url'); ?>">
   <?php _e("Home"); ?>
   </a>
</li>

Put this before wp_list_pages,this must be first li item.

I'm just curious: Why you use `_e()` function instead of writing code directly? Thanks!
Ionut Staicu
it is for localization _e() and _()
+2  A: 

user303832 is right but this is more like it.,

<li <?php if(is_home()) { ?>class="current_page_item"<?php } ?>>
   <a rel="<?php _e("bookmark"); ?>" title="<?php _e("Home"); ?>" href="<?php bloginfo('url'); ?>">
   <?php _e("Home"); ?>
   </a>
</li>

I use the "current_page_item" class on HOME to if i have a style applied to current page "link".

Chris Schroeder
+1  A: 

Upgrade to WordPress 3.0 and you'll find a built in menu creator. No PHP knowledge needed. This should work in modifying the navigation for most themes.

rxn
Thanks a lot, Wordpress 3.0 rocks!
Johann