Support » Themes and Templates » TwentyTen Child: Remove Home Menu

  • I’ve seen the advice to remove the Home menu from TwentyTen by changing show_home to false , as follows:

    /**
    * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
    *
    * To override this in a child theme, remove the filter and optionally add
    * your own function tied to the wp_page_menu_args filter hook.
    *
    * @since Twenty Ten 1.0
    */
    function twentyten_page_menu_args( $args ) {
    $args[‘show_home’] = false;
    return $args;
    }
    add_filter( ‘wp_page_menu_args’, ‘twentyten_page_menu_args’ );

    While this works sort of, I also have to delete the Home title from the homepage or else Home still appears, and this code only works in the parent functions.php file. I can’t seem to get the code right in a functions.php child file – I get syntax and other errors using a variety of attempts including remove_filter etc.

    Can anyone point me in the right direction to enable a working functions.php child file that will turn off my Home menu while allowing me to still name the homepage Home?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’m having the same problem. The comment in the original theme does not make any sense to me. Aren’t child themes functions loaded before the parent ? If so, there will not be a filter to remove…

    The only working answer is to edit the parent functions.php file to set show_home to false.

    what is name of child theme?

    If it is 2010 weaver then goto 2010functions.php file and put false(line 272).

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

    “The way to get around this is to use the after_setup_theme action hook. This action is called immediately after both functions.php files are loaded.”

    From:

    WordPress PROTIP: Child Themes

    If you don’t understand what Chinmoy29 ans klebba are saying, here’s the simple way to do it for a Child Theme based on TwentyTen:

    1. Create a functions.php file in your root childtheme folder
    2. Put this content in it:
    <?php

    /* Retirer le lien “HOME” du menu de navigation */
    function removeHome( $args ) {
    remove_filter(‘wp_page_menu_args’, ‘twentyten_page_menu_args’);
    $args[‘show_home’] = false;
    return $args;
    }
    add_action( ‘after_setup_theme’, ‘removeHome’ );

    This worked great, ty!

    FMaz008, thanks, this works indeed

    /* Retirer le lien "HOME" du menu de navigation */
    function removeHome( $args ) {
    remove_filter('wp_page_menu_args', 'twentyten_page_menu_args');
    $args['show_home'] = false;
    return $args;
    }
    add_action( 'after_setup_theme', 'removeHome' );
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘TwentyTen Child: Remove Home Menu’ is closed to new replies.