Support » Fixing WordPress » wp_page_menu: re-name “home”?

  • Resolved mencius

    (@mencius)


    so I am calling my page list with the
    <?php wp_page_menu('show_home=1&amp;sort_column=menu_order'); ?>
    function, which is populating an unordered list that has a “home” entry in my nav bar.

    I want to change the name of this “home” button to “blog”, but am not sure how to do this within the context of the wp_page_menu arguments. I want to keep it pretty clean, so was hoping to find something that didn’t involve me manually linking a first item in that unordered list. Any thoughts?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Your choices would seem to be:
    1. manually linking a first item in that unordered list
    2. changing the program that has that function (wp-includes/post-template.php)
    3. put this in your theme’s function.php file:

    function change_home($menu_text) {
    return preg_replace('/>Home</', '>Blog<', $menu_text, 1);
    }
    add_filter('wp_page_menu','change_home');

    Justin Tadlock

    (@greenshady)

    WordPress God

    Those choices don’t look very fun! 😉

    Try this out:

    <?php wp_page_menu( array( 'show_home' => 'Blog', 'sort_column' => 'menu_order' ) ); ?>

    Cool. Didn’t know you could do that with wp_page_menu. Codex updated: http://codex.wordpress.org/index.php?title=Template_Tags%2Fwp_page_menu&diff=69816&oldid=69679

    thanks Shady, you are a champion…. saving my bacon.

    Justin Tadlock

    (@greenshady)

    WordPress God

    Also, if you need to filter it from a plugin or child theme, use this:

    add_filter( 'wp_page_menu_args', 'my_page_menu_args' );
    
    function my_page_menu_args( $args ) {
    
    	$args = array(
    		'show_home' => 'Blog'
    	);
    
    	return $args;
    }

    Any idea how to do this in the Arras theme? I can’t find the bit in my code?

    My website is http://www.dykulture.com

    Eeeek! Wow, complicated! Any idea how to do the same thing for the Arras theme? My website is http://www.dykulture.com – I just can’t seem to find the right bit of code in the header.php file.

    Many thanks.

    What file do I put this in?<?php wp_page_menu( array( 'show_home' => 'Blog', 'sort_column' => 'menu_order' ) ); ?>

    Do I replace code or just insert this somewhere?

    You can also try deleting this line of code:

    if ( !is_front_page() ) { ?><li class="page_item_home home-link"><a href="<?php bloginfo('home'); ?>/" title="<?php echo wp_specialchars(get_bloginfo('name'), 1) ?>" rel="home"><?php _e('home', 'plaintxtblog') ?></a></li><?php }

    From your theme’s functions.php file. I am using the simplr theme and this worked for me.

    This is for if you want to remove the “home” link altogether.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘wp_page_menu: re-name “home”?’ is closed to new replies.