ThemeShaper Forums » Thematic


Can't get dropdowns to work with wp_nav_menu

(16 posts)
  • Started 10 years ago by mmikkel
  • Latest reply from em hr
  • This topic is resolved
  1. mmikkel

    Hello, I realize there's a few topics already about this issue, but none of them helped me.

    I'm having troubles getting the dropdowns to work with 3.0 (final version).

    My code:

    // Adding wp_nav_menu support to Thematic
    function theme_add_menu_support() {
    	add_theme_support( 'menus' );
    // Registering the main menu
    function theme_register_menus() {
    	register_nav_menu( 'hovedmeny', __( 'Hovedmeny' ) );
    add_action( 'init', 'theme_register_menus' );
    // Removing the standard Thematic menu
    function theme_remove_standard_menu() {
    add_action('init', 'theme_remove_standard_menu');
    // Adding the new main menu
    function theme_new_menu() { ?>
    	<div id="access">
      		<div class="skip-link"><a href="#content">">
        	<?php _e('Skip to content', 'thematic'); ?></a></div>
        		<?php wp_nav_menu( array( 'theme_location' => 'hovedmeny','menu_class' => 'sf-menu','container' => 'menu' ) ); ?>
    		<!-- access -->
    	<?php }

    I know Superfish is called correctly and finds the ul, because the .sf-js-enabled class is added to it. Upon mouseover, the child pages are not dropping down, though.

    Anybody know whats up? I've tried a fresh install of both Thematic and WP3.0, and added the menu as the first thing I did. It still didn't work.

    What am I doing wrong? :)

    Posted 10 years ago #
  2. My submenus dont show up either but the cause is I have huge headers rotating with jquery. That might be it if I'm not mistaken.

    Posted 10 years ago #
  3. mmikkel

    No, this is on a fresh install of Thematic, through an un-edited Child Theme (except for the change to wp_nav_menu I didn't change anything in functions.php).

    I'm stumped. Probably I'll strip away the Thematic js and just create my own dropdown script. I'm really dependent on wp_nav_menu for this project...

    Posted 10 years ago #
  4. someone posted this. can't remeber who.

    // we declare that our theme supports wp_nav_menu()
    add_theme_support( 'nav-menus' );
    // we register the a new menu for the theme called "primary menu"
    function register_primary_menu() {
    	register_nav_menu( 'primary-menu', __( 'primary menu' ) );
    add_action( 'init', 'register_primary_menu' );
    // we remove the standard thematic menu
    function remove_menu() {
    add_action('init', 'remove_menu');
    // we create the new wp_nav_menu called "primary menu" in our theme
    function new_access() { ?>
    	<div id="access">
    		<div class="skip-link"><a href="#content" title="<?php _e('skip navigation to the content', 'thematic'); ?>"><?php _e('skip to content', 'thematic'); ?></a></div><!-- .skip-link -->
    			<?php /* our navigation menu.  if one isn't filled out, wp_nav_menu falls back to wp_page_menu.  the menu assiged to the primary position is the one used.  if none is assigned, the menu with the lowest id is used.  */ ?>
    			<?php wp_nav_menu( array(
                              			'theme_location' => 'primary-menu', // we define this as being the previously registered "primary menu"
                              			'menu_class' => 'sf-menu', // we assign the sf-menu class to the menu ul so that superfish workds
                              			'container_class' => 'menu' // we assign the menu class to the menu container div so to keep it compatible with the thematic menu styling
    	</div><!-- #access -->

    i had a few problems with a certain site and this sorted it

    Posted 10 years ago #
  5. found the original author of the code.

    Posted 10 years ago #
  6. although for ALL but ONE sites
    EM HR's simple code works for me

    add_theme_support( 'menus' );
    function child_access_menu() {
    	$menu_sys = 'wp_nav_menu';
    	return $menu_sys;
    add_filter('thematic_menu_type', 'child_access_menu');
    Posted 10 years ago #
  7. mmikkel

    Jonny Janiero, thanks for replying!

    The first code sample you posted (theorib's) I'd already tried and it does not work. It renders the correct wp_nav_menu but drop downs does not show - this is on a fresh install of Thematic with the supplied child theme enabled. The only thing I changed in the child theme is to paste the above code into functions.php.

    The second code you posted, HR's simple code, doesn't work at all - it just renders the standard wp_page_menu (with working drop downs).

    Am I the only one who's experiencing problems here? The thing that bugs me is that this happens on a fresh install of the blank Thematic child theme example... there's nothing in the child theme to kill off the dropdowns.

    I'm not savvy enough to get this to work on my own, I don't think. Would really, really appreciate further input from anyone... :)

    Posted 10 years ago #
  8. mmikkel

    Update: Just installed the latest stable development release of Thematic ( Now, HR's simple code does work (my wp_nav_menu renders), however drop downs still doesn't work.

    The same goes for theorib's code.

    Posted 10 years ago #
  9. sort of at a loss, b/c Gene's snippet works for me too. although the person i was last designing a theme for had issues w/ using it live. though i think at the time he was using the older version of thematic.

    are the hoverIntent.js, superfish.js, supersubs.js and thematic-dropdowns.js definitely in your <head> tag when you view source?

    do you have javascript disabled on your browser?

    Posted 10 years ago #
  10. Do you have Firebug installed in Firefox? Using the Net tab, and observing what javascript files load during a refresh has helped me ALOT when diagnosing javascript issues.

    Not a fix, but may give us a direction..

    Posted 10 years ago #
  11. also any chance this is live somewhere so you could post a link?

    Posted 10 years ago #
  12. mmikkel

    Sweet, thanks for replying guys :)

    @helgatheviking: The files are definitely in the source, right where they should be. I've also tried removing all other Javascript files from the source in case of a silent conflict, but it didn't make any difference. Also, Javascript is enabled in my browser. The dropdowns work fine with wp_page_menu.

    @tarpontech: I do have Firebug installed - however I wouldn't know what to look for in the Net tab, I've never used anything but the CSS and console tabs. Any pointers?

    I've put the site up online now, if anyone has a chance to take a look I'd be much obliged. I'm stumped! The (very unfinished, mind you) site is in Norwegian (what little content there is), but the main menu elements called "PRODUKTER" (products) and "KUNDESERVICE" (customer service) should both have dropdowns, as they point to pages containing several child pages. The site currently has the *actual* theme enabled, but like I've said previously, I couldn't get the dropdowns to work even with a clean and fresh Thematic child theme.

    I've password protected the folder, username is "guest" and password is "thematic". I can provide a guest account to the WP installation itself if neccessary. Also, I've posted my functions.php file in .txt format here:

    The code for the menu should start around line 216, do a search for the string "/* MENUS */".

    Probably I've just made an embarrassingly obvious error somewhere, but I really can't figure this one out. Any help is much appreciated!

    Posted 10 years ago #
  13. mmikkel

    Wow. As I wrote the previous post - at the part about the child pages - it suddenly struck me that this might not be a Thematic-related problem at all. I finally had the common sense to check the Wordpress output, and it seems that wp_nav_menu isn't writing out the child pages at all; there's no <ul class="children"> or anything like that.

    I'm currently investigating the matter, have anyone experienced this before with wp_nav_menu? I have the depth parameter set to 0, which should get all child pages - in theory...

    Posted 10 years ago #
  14. mmikkel

    Haha. I am a huge idiot.

    I didn't realize I had to manually add the child pages to the menu via Dashboard. Oh man.

    So big surprise, turns out I was right - this was just about me making some embarrassingly obvious error.

    Sorry, people!

    Posted 10 years ago #
  15. LOL. :) sometimes the answers are SO obvious that we can't see the forest for the trees. i think someone else recently had the exact same issue as you.. 3.0's menus don't auto add children. glad to know you have found it! sometimes just posting about it can lead you to find your own answer.

    Posted 10 years ago #
  16. Hi,

    Heads up using add_theme_support in this way is not advised



    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.