WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_page_menu: re-name "home"? (10 posts)

  1. mencius
    Member
    Posted 5 years ago #

    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?

  2. MichaelH
    Member
    Posted 5 years ago #

    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');
  3. Justin Tadlock
    Member
    Posted 5 years ago #

    Those choices don't look very fun! ;)

    Try this out:

    <?php wp_page_menu( array( 'show_home' => 'Blog', 'sort_column' => 'menu_order' ) ); ?>
  4. MichaelH
    Member
    Posted 5 years ago #

    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

  5. mencius
    Member
    Posted 5 years ago #

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

  6. Justin Tadlock
    Member
    Posted 5 years ago #

    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;
    }
  7. LynneB
    Member
    Posted 4 years ago #

    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

  8. LynneB
    Member
    Posted 4 years ago #

    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.

  9. nativewisdom
    Member
    Posted 4 years ago #

    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?

  10. cj9
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic