• Resolved creativegoat

    (@creativegoat)


    Hello wordpress friends, this is the first time i post here and i would really love to get some help.

    I’m having a really weird issue for some time now and i feel like it’s time to get it resolved.

    On the header.php of my template i’m calling this nav:

    <nav class=”top-nav”><?php wp_nav_menu( array( ‘theme_location’ => ‘header-navigation’ ) ); ?></nav>

    Works perfectly, and gives me the lovely hook “current-menu-item” on the current menu item.

    The problem is, when i try to call the same nav on my footer:

    <nav class=”bottom-nav”><?php wp_nav_menu( array( ‘theme_location’ => ‘header-navigation’ ) ); ?></nav>

    I don’t get the “current-menu-item” class, even if i call a totally different nav, it just won’t output the class.

    I just tested the two navs together in the header and they both output the current-menu-item class, so i’m thinking it has to be the footer that’s doing something fishy.

    The template is fairly simple, looks like this:

    http://dl.dropbox.com/u/67957732/Screenshots/bo.png

    Any clue?, thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael

    (@alchymyth)

    there might be some code within the template between header and footer (for instance in the sidebar, or by any plugins) which is altering the querystring;

    double check for un-resetted custom queries; and as a quickfix, try to add wp_reset_query(); before the footer nav.

    Thread Starter creativegoat

    (@creativegoat)

    Hey man, that was awesome, your quick fix totally worked.

    Is there a way to see what part of the code is altering the query string?

    Thanks do much, it’s a tiny design thing what i want to achieve but it’s always cool to know what’s going on in your code.

    Michael

    (@alchymyth)

    Is there a way to see what part of the code is altering the query string?

    before the new reset line, you could try to dump the query to see what is in it which might give you some clues to where it is altered:

    <?php var_dump( $wp_query ); ?>

    otherwise look at the output of the website and check all output (I guess it could be a widget or plugin in the sidebar – like ‘related posts’ or some similar stuff daaded to the posts/pages content via filter from a plugin ?)

    Thread Starter creativegoat

    (@creativegoat)

    You are absolutely right it’s a plugin that i’m using to out post from a category.

    Because i have to use this plugin and i didn’t do it i wouldn’t like to mess with the code, is it a bad practice to just use the “wp_reset_query();” method?

    Thank you so much my friend, you are very kind.

    Michael

    (@alchymyth)

    is it a bad practice to just use the “wp_reset_query();” method?

    if it works, it might be ok;
    although it is always better to cure the cause rather than fixing the symptoms.

    Thread Starter creativegoat

    (@creativegoat)

    Agree, will dig deeper, thanks for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Footer menu is not giving me "current-menu-item"’ is closed to new replies.