ThemeShaper Forums » Thematic

[closed]

menu behavior while single posts

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

Tags:

  1. treibstoff
    Member

    hello,
    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...

    but
    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???
    please!

    have a look here:
    blog.m(xxx)iriamwu(xxx)ttke.de
    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:
    http://forums.themeshaper.com/topic/child-theme-change-nextprevious-links-to-within-category#post-4455

    Posted 9 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:

    http://codex.wordpress.org/Function_Reference/wp_reset_query

    -Gene

    Posted 9 years ago #
  3. treibstoff
    Member

    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:
    blog.m(xxx)iriamwu(xxx)ttke.de
    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 9 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.

    -Gene

    Posted 9 years ago #
  5. treibstoff
    Member

    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....

    sic!

    cheers

    Posted 9 years ago #
  6. treibstoff
    Member

    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_search='current_page_parent';
    	$my_replecement = '';
    	return str_replace($my_search, $my_replecement, $output);
    	}
    add_filter('wp_page_menu','child_add_menu_items');

    to be placed into functions.php

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.