• MtnExile

    (@mtnexile)


    I’m sure this is a very basic question, but something is just eluding me here.

    I have a blog with several pages: about, contact, etc. I want the front page to be the latest posts, but I want that front page to be labeled “Home” in the navigation. Creating a “Home” page obviously doesn’t do it.

    I’m using a CSS technique that requires spans (to allow a “display: none” declaration), so the navigation code is as follows:

    <?php wp_nav_menu( array(
    		'menu' => 'custom menu' ,
    		'link_before' => '<span>' ,
    		'link_after' => '</span>' ));
    	?>

    And this functions just fine. But how do I get “Home” to show up in the menu?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Big Bagel

    (@big-bagel)

    Your call to wp_nav_menu() is specifically targeting a custom menu named “custom menu”. Did you make a custom menu with that name in “Appearance->Menus”? You can add any link you want to a custom menu, including a “Home” link that points to your front page.

    Thread Starter MtnExile

    (@mtnexile)

    There is no such feature in my dashboard menu. Under “Appearance” there are “Themes,” “Widgets,” and “Editor,” but no “Menu.”

    And no, I simply copied the code from another theme and it seemed to work. I told you this was a very basic question.

    Big Bagel

    (@big-bagel)

    I think you might be confused as to the intendted use of wp_nav_menu() then, which is to allow custom menus through “Appearance->Menus”.

    Function Reference/wp nav menu
    Appearance Menus Screen

    If you don’t plan on ever using that functionality, you should use wp_page_menu() instead.

    Function Reference/wp page menu

    Big Bagel

    (@big-bagel)

    Just for the sake of being complete, here’s an example of what I think you’re going for:

    $args = array(
        'show_home'   => true,
        'link_before' => '<span>',
        'link_after'  => '</span>'
    );
    
    wp_page_menu( $args );
    Thread Starter MtnExile

    (@mtnexile)

    Bagel, thanks for trying to help. I really do appreciate it, because it can be difficult to get answers to very basic questions. As it turns out, I did some more looking at other themes and some Googling, and figured out what to do to get the custom menus working. After that it was easy.

    I should also say that you’re wrong to think I’m “confused.” What I am is pig-ignorant. I don’t know enough to be confused about anything.

    Big Bagel

    (@big-bagel)

    Indeed, adding the ability to use custom menus to a theme that doesn’t support them is a simple matter of adding a small amount of code in functions.php. I just didn’t know that’s what you wanted…

    For any future readers, here are a couple tutorials on enabling custom menus in a theme that doesn’t already support them:

    https://www.wpbeginner.com/wp-themes/how-to-add-custom-navigation-menus-in-wordpress-3-0-themes/
    https://www.devlounge.net/code/how-to-add-support-for-menus-in-your-wordpress-theme

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Home page not showing up in the menu…what am I doing wrong?’ is closed to new replies.