• Resolved jiraiya

    (@jiraiya)


    Hi Folks,
    I posted a topic yesterday regarding a problem I have run into in TwentyTen and wp_nav_menu. Basically I have found that if you set you wordpress options to show a static page instead of the latest post as your home page then the home link will not show any drop downs and any child pages become top level links.

    To recreate:
    Create a page named home.
    Create some pages as children.
    They display fine.
    ****Now for the problem****
    Change your options to display a static page as front page i.e. your home page.
    Now reload your page and voila your child pages will no longer drop down on home and will display as top level items.

    I hope I’m wrong on this but it seems that this is a problem. Any help is appreciated.
    Cheers,
    Barry.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter jiraiya

    (@jiraiya)

    Sorted this one guys. Not so much a bug as just a behavourial difference between TwentyTen and wordpress core. If you do as I posted initially the confusing behavior does indeed exist, no doubt. To solve it you need to override a function. The TwentyTen theme was specifying that a home page of my posts be displayed. However if you turn it to a static page in the options then the static home page is indeed displayed but it seems to throw things out of sync with the wordpress core and the drop downs wont work. The solution is as follows. Remove the filter which adds the home page. Then they play nice together. Hope it helps someone else.

    <?php
    /* Perform some setup on the child theme */
    add_action( 'after_setup_theme', 'child_theme_setup' );
    
    function child_theme_setup() {
    /* We don't want to display a default home page. */
    remove_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
    
    /*Add a new menu location*/
    register_nav_menus(
        array('left-sub-menu' => __( 'Left Sub Menu' ) )
      );
    }
    
    ?>

    I can’t replicate this behaviour in Twenty Ten.

    Hi, I can replicate it anytime. This happens every time with the TwentyTen theme, including today when I (finally) started up my official company site with a fresh installation of 3.1.1. Hence my presence here looking for an answer ??

    Problem description: The Home page menu works perfectly if you do not select a Front Page (the menu displays all parent pages with all subpages listed in dropdowns). Choose a parent page as the Front page, and suddenly the default menu shows not only top-level pages and their children as dropdowns, but sub-pages with dropdowns, and then it blorfs out and displays a bunch of pages as top links, even when they’re subpages. You can deselect / reselent the Front page and watch the problem disappear / reappear.

    Screenshot links:
    No front page selected, Site Development menu shown
    Site Development parent selected as Front Page

    I do always have a Maintenance Mode plugin activated to protect the sites while they’re under development, but I’ve disabled and deleted it for those screenshots, so that’s not it. The content today came from an import (I developed it on a local server), so I don’t know if that’s a factor, but WP had no import issues, and when I look at the Pages admin menu, everything looks perfect.

    I will try Jiraiya’s solution and post back if it works.

    Thread Starter jiraiya

    (@jiraiya)

    Hi dains,
    I read your post today. I hope the solution fixed your problem. If you run into any more difficulties you can post here again and I’d be happy to help.

    Hello Jiraiya! I implemented your solution using a child theme functions.php and it did indeed fix the problem perfectly. Thank you for creating it!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Possible bug with wp_nav_menu’ is closed to new replies.