WordPress.org

Ready to get started?Download WordPress

Forums

Custom Theme not Showing Sub-Menus (8 posts)

  1. ramjet
    Member
    Posted 1 year ago #

    Hello,

    I have a custom theme and my first level menu items are showing but anything below in the hierarchy is not showing as sub menus. If I switch back to the twenty twelve theme the sub menus show at all levels so I take that as a valid test my menu is setup correctly.

    The theme I am customizing had this line:
    wp_nav_menu( array( 'theme_location' => 'bar', 'depth' => 2 ) )

    well according to codex depth is an optional parm and used to control how many levels are shown. So I set it to zero
    wp_nav_menu( array( 'theme_location' => 'bar', 'depth' => 0 ) )
    and now my sub menus show...sorta. On the screen during mouse over they still do not display but inspecting with developer tools (F12) I see the UL / LI items for the sub menus are now generated.

    Now I am new to php and wordpress but have been developing in c# for over 10 years so I feel comfortable with the changes I have made but clearly I am still missing something.

    I have compared my code to theirs (twenty twelve) and am unable to find the difference.

    Any pointers greatly appreciated
    JB

  2. ronangelo
    Member
    Posted 1 year ago #

    Did you put correct CSS to make the sub-menus show when top menus are hovered? Or are the sub-menus REALLY missing, as in no html is being generated?

    Could you post the url to your site?

  3. ramjet
    Member
    Posted 1 year ago #

    HTML is being generated but unable to find the relevant css section...standby for url.

  4. ramjet
    Member
    Posted 1 year ago #

    http://journeytosurthrival.com/
    In The Beginning >> Squash The Excuses >>

  5. ramjet
    Member
    Posted 1 year ago #

    Ooops forgot I had the theme switched. Try again if you had previously.

  6. ramjet
    Member
    Posted 1 year ago #

    I don't know how you would do this in css. More like script I would think??? How would you know how many sub categroies there are? Seems more likely that on mouse over you would query for sub categories and show if > 0??

  7. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    You can look at the CSS for another theme - like twentytwelve - using a browser tool like Firebug is quite helpful for doing so.

  8. ramjet
    Member
    Posted 1 year ago #

    I have! I'm not smart enough to get it. Twenty Twelve does not to my discovery have a:hover. I can find all sorts of a decorations but no a:hover. Yet somehow twenty twelve shows the sub-menu.

    I do have this in my css
    #navi li ul li {width:12em; padding-bottom:.25em; overflow:hidden;}
    and if I remove overflow then the sub-menu shows *BUT* not on hover but all the time...which is not what I want.

    I know how to inspect the code I think I just don't know exactly what the nugget is that I am looking for.

Topic Closed

This topic has been closed to new replies.

About this Topic