ThemeShaper Forums » Thematic

[closed]

Need help with figuring out why Home is not appearing in Menu

(10 posts)
  • Started 13 years ago by Solomon
  • Latest reply from mikolaj
  • This topic is resolved
  1. I've uncommented this bit in my child theme's functions.php:

    // Add a home link to your menu
    function childtheme_menu_args($args) {
        $args = array(
            'show_home' => 'Home',
            'sort_column' => 'menu_order',
            'menu_class' => 'menu',
            'echo' => true
        );
        return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args');

    ...and still I'm not seeing a "Home" choice in my default navigation menu. I have to create a custom menu to get that.

    Can someone give me some idea of what to look for as to why this may not be working for me? What might I be doing/have done wrong?

    Posted 13 years ago #
  2. its my understanding that the above code no longer works.
    see the following thread
    http://forums.themeshaper.com/topic/home-tab-disapeared-with-the-update#post-16157

    i tend to always use the new 3.0 menu system nowadays.

    the code snippet above should maybe removed(or ammended) as an example in the functions.php

    Posted 13 years ago #
  3. Worked like a charme. Thank you. Here's the code for others:

    function childtheme_menu_args($args) {
        $args = array(
            'show_home' => 'Home',
            'sort_column' => 'menu_order',
            'menu_class' => 'menu',
            'echo' => false
        );
        return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args', 20);
    Posted 13 years ago #
  4. The 'Home' button doesn't show up when I use a custom menu as primary menu. I can add a link to homepage and name it 'Home' but then it doesn't recognize the site as 'current page' and it is not styled properly (there is a border-bottom). Should I change 'menu_class' in the code above or is there another solution?

    Posted 13 years ago #
  5. noelc
    Member

    just add the following code to your function.php file it works currently in wp3.0
    ---------------------------
    function home_page_menu_args( $args ) {
    $args['show_home'] = true;
    return $args;
    }
    add_filter( 'wp_page_menu_args', 'home_page_menu_args' );

    Posted 13 years ago #
  6. I've got WP 3.0.4 with Thematic 0.9.7.7 but it works unfortunately only with the default menu and only when I add 20 before the end of last bracket:


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

    It doesn't work with my custom menu.
    What is wrong here?

    Posted 13 years ago #
  7. nothing is wrong. show_home is not an argument of wp_nav_menu which is the function that creates the custom menus. if you want to add a home link in a custom menu, you have to generate a custom link and specify your home URL. i think that is sort of weak on WP's part as almost everyone puts a home button in their menu, but there ya go

    Posted 13 years ago #
  8. Thanks for clarifying that.
    But then there is a styling problem I described in the first post above.
    How to make the 'Home' button in a custom menu to recognize that it is 'current page' and style properly (no border in the bottom)?

    Posted 13 years ago #
  9. as i said i add a home link w/ a "custom link" and setting the URL to my "mydomain.com". this seems to pick up the dynamic classes just fine.... even with my blank child theme, but then i am using a very recent thematic and WP 3.1 RC2. that could be the difference i dont have any way of checking

    here are the i get on the home item when on my home page:

    <li id="menu-item-103" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-103"><a href="http://localhost/single">Home</a></li>

    so you can see that i am still getting current-menu-item and especially current_page_item

    Posted 13 years ago #
  10. OK, I got it. My mistake was that I didn't put '/' at the end of URL of the home page. It was linking correctly but it didn't recognize the current page.
    So the URL must look like this:
    http://www.literka.net/

    Thanks for help.

    Posted 13 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.