ThemeShaper Forums » Thematic


menu behavior while single posts

(6 posts)
  • Started 11 years ago by treibstoff
  • Latest reply from treibstoff
  • This topic is resolved


  1. treibstoff

    I'm using the superfish menu horizontal with sub sub menus.
    Everything is fine with it....just:

    On many pages I use query_post statements for category post.

    My problem:
    If I open one of those posts it opens with the single.php like it should do...

    then the menu item always highlites in my case the NEWS item and not the Menu item the single post belongs to.....sic!

    Anybody got a function to resolve this???

    have a look here:
    without the (xxx)- sure!

    For another problem of those singe posts regarding the prev./ next. page finding the category follow up I found here this solution:

    Posted 11 years ago #
  2. Hi treibstoff,

    I'm not sure I'm understanding exactly. Try resetting the query with:

    <?php wp_reset_query(); ?>

    call this function immediately after your custom query.

    Look here for more info on this function:


    Posted 11 years ago #
  3. treibstoff

    thanx for your reply,

    no, thats not the problem.

    If I open a menu item like for excample 'Publications' (and that page is not the index but build with query statements)
    and open than inside this page an article, the menu than highlites not anymore the 'Publication' item but 'news' (the index.php), 'cause the article is using the single.php.

    I forgot to say:
    This Behaviour also happens for Archiv pages, tag pages or search pages.. They all highlites the 'new' item instead of nothing in the main menu?

    I even would be happy to find a solution that better highlites no item than the wrong one.

    Have a look here:
    without the (xxx)- sure!

    As I told before the second problem regarding the category problem of preview next function on those single posts is solved.

    Posted 11 years ago #
  4. Now I'm getting it. It sounds like you are experiencing the default behavior of WordPress assigning .current_page_item and/or .current_page_parent to your main navigation. This behavior's interaction with your custom query results in assigning "current" class ancestry to the WP Blog Page on parts of you site where your don't want it to.

    Here are my suggestions:

    I'm assuming you have made custom templates or hooked in to Thematic to insert your query. Make sure you have placed the query after the call to the header.php or that you have hooked your query into an action hook that comes after the main navigation is complete.

    You may need to remove the news page from being set as the the "blog" page from within the wp-admin to fix the menu highlighting of that page for archives and search results. If you do remove it from being the blog page, then you'll need to create a template for the page or hook in to Thematic to insert a custom query for that page.

    Those two things and some creative adjustment to the #access parts of your CSS using the dynamic body classes to achieve your "current" and "ancestor" navigation states should get you headed in the right direction.


    Posted 11 years ago #
  5. treibstoff

    hi em, thanx for your fast reply.....

    have to overthink all....
    I was thinking there is a triky function to deal with....but

    my approvement, right now, was to set
    <?php if (is_single() or is_tag() or is_archive() or is_search() ) {

    echo '<style>li.current_page_parent {background:#fff} .current_page_parent li {display:none} </style>';

    } ?> inside the header.php

    display:none just removes the submenu from NEWS.
    Just searching the correct CSS part that affects also the background highlight of NEWS....



    Posted 11 years ago #
  6. treibstoff

    one step more...

    better than the above...and just to avoid that any menu-item highlites or will show also the submenu of that item while article opens in single, archiv, tag, search.php:

    function child_add_menu_items($output) {
    	$my_replecement = '';
    	return str_replace($my_search, $my_replecement, $output);

    to be placed into functions.php

    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.