• Hello!

    There is any option to change the phrase “Home” that used for the home link in the function wp_nav_menu() without editing any language file?
    (like some preg_match that I will add in functions.php
    to change this phrase).

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • wp_nav_menu doesn’t create any Home link. In the absence of a custom menu, it falls back to wp_page_menu which does create a Home link. So the solution would seem to be – create a custom callback for wp_nav_menu.

    If you using custom menus you can change the label.
    on Menus page click on a small arrow on Home change the label to what ever you want.

    Thread Starter Yonatan Ganot

    (@xxxyonixxx)

    Do you can give me some example of “custom callback” for wp_nav_menu() function?

    // Called in sidebar.php for Categories if no custom menu is defined
    if ( !function_exists( 'zenlite_callback_cats' ) ) :
    function zenlite_callback_cats() {
    	?>
    	<ul>
    	<li<?php if(is_front_page() || is_home()) echo ' class="current_page_item"';?>><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'zenlite');?></a></li>
    	<?php wp_list_categories('title_li=');?>
    	</ul>
    	<?php
    }
    endif;
    Thread Starter Yonatan Ganot

    (@xxxyonixxx)

    To add this home link in theme I’ve added this code to the “functions.php” file:

    function themename_page_menu_args( $args ) {
    	$args['show_home'] = true;
    	return $args;
    
    }
    add_filter('wp_page_menu_args', 'themename_page_menu_args');

    I know that there is the variable:
    $text = __('Home'); that sets the phrase text, so there is option to change this via the “functions.php” file?

    Michael

    (@alchymyth)

    instead of true enter the name for your home page:

    function themename_page_menu_args( $args ) {
    	$args['show_home'] = 'HOMEPAGE';
    	return $args;
    
    }
    add_filter('wp_page_menu_args', 'themename_page_menu_args');
    Thread Starter Yonatan Ganot

    (@xxxyonixxx)

    Thanks that’s works! ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Changing "Home" phrase in the template(without editing languages files)’ is closed to new replies.