WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Removing the "Home" button from wp_nav_menu (6 posts)

  1. Stefanovitsh
    Member
    Posted 1 year ago #

    Hello folks!

    I'm sure you have seen this question around a hundred times already, but the fact is, I can neither get my problem fixed, not understand its roots. Here's the problem.

    I'm using wp_nav_menu function to display my navigation menu. But for some reason it creates another nameless list item in the list with a link to the main page. The first thing I did was, of course, search for a solution in Google. Many pages came out and I tried different stuff, but neither worked.

    Now, I know coding only on a basic level, but I'm developing my own theme from scratch. Since I can't understand, where the problem lies, maybe you guys can help me find it?

    You can see the menu on this page: http://challenge.mastdesign.net
    I've added some ugly visual styles, that might help you see it better.

    At this very moment, my functions.php file is as follows:

    <?php
    
    	/* Menu Module */
    	add_theme_support( 'menus' );
    
    	/* Featured Image Module */
    	add_theme_support( 'post-thumbnails' );
    
    	function mytheme_nav_menu_args( $args ) {
    	    $args['show_home'] = false;
    	    return $args;
    	}
    	add_filter( 'wp_nav_menu_args', 'mytheme_nav_menu_args' );
    
    ?>

    Cheers!

  2. Stefanovitsh
    Member
    Posted 1 year ago #

    Update: It seems that it's not really the wp_nav_menu, that is the source of the problem. I've just created a simple hard-coded list, but it still receives an extra div with a link to the homepage. And now I'm confused. Any ideas what might be the problem?

  3. Stefanovitsh
    Member
    Posted 1 year ago #

    Okay, nevermind. Fixed it.

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    Can you post your solution for others to follow?

  5. Stefanovitsh
    Member
    Posted 1 year ago #

    Basically it was an attention problem. An unclosed tag. The a tag was open in logo image and I forgot to close it, so it added a link to every single element that separated it from the next closed a tag.

  6. Hemalis
    Member
    Posted 1 year ago #

    just do one thing search on your theme "show_home" . you need to set this as a false. It works for me. I currently change in two pages of functions.php of plugin and themes ..
    Here i do following and works fine :

    $args['show_home'] = false;

Topic Closed

This topic has been closed to new replies.

About this Topic