ThemeShaper Forums » Thematic

[closed]

Highlight menu related to opened post/category/page

(11 posts)
  • Started 8 years ago by alexenergy
  • Latest reply from alexenergy
  • This topic is resolved
  1. For a user-friendly menu, we may like to highlight the menu option which opened a specific post,page or category

    I found a solution to highlight menu for pages:

    To highlight an opened page, no problem, there is built-in class for WP so we can use css

    .sf-menu .current_page_item a,
    .sf-menu .current_page_ancestor a,
    .sf-menu .current_page_parent a {
    background: TEAL;
    background: url("images/your-button-background-to-highlight.gif") no-repeat;
    }

    To highlight menu for a single post or for a category, we will not find CSS to control this because there is no class ready in WP, neither Thematic. Weird!

    So maybe we can create a class, something like current_post and current_category

    Any suggestions?

    Posted 8 years ago #
  2. Now, I found the solution my self. It is strange that this is not included in the CSS for Thematic. Maybe the reason is that these classes were added on WP 3.0

    .sf-menu .current-menu-item,
    .sf-menu .current-page-ancestor,
    .sf-menu .current-post-ancestor {
    border-bottom-color:#fff;
    background: TEAL;
    }
    I recommend you this strongly if you use dynamic menus and also if you like to change your menu frequently from the WP administrator. It is far much easier and simple.

    Posted 8 years ago #
  3. I have made some corrections to work properly with all possible options

    .sf-menu .current-menu-item a,
    .sf-menu .current-post-ancestor a,
    .sf-menu .current_page_item a,
    .sf-menu .current_page_ancestor a,
    .sf-menu .current_page_parent a {
    border-bottom-color:#fff;
    background: RED;
    }

    But this still not work for custom links in the menu

    Posted 8 years ago #
  4. I checked that it works also for all custom links, except Home if you point index.php

    Posted 8 years ago #
  5. Thanks, submitting this fix to the Google code site would be the best way to have this correction added to the theme.

    http://code.google.com/p/thematic/issues/list

    -Gene

    Posted 8 years ago #
  6. Done! I have uploaded this fix to code google as issue 102: Highlight the menu related to content when mouseout

    Alex

    Posted 8 years ago #
  7. Hi,

    I'm a new user of Wordpress/thematic but am thoroughly impressed. I don't know whether to start a new thread, but this one seems to be on the same topic.

    I want to style top level menu entries to look a little different when they are the active page. This has worked very well with pages and sub-pages. It also works with the top level item 'blog'. If I select blog>>photography (a category), the active page highlight is gone.

    Is there a way to work around this?

    Posted 8 years ago #
  8. Try Using current_page_parent which is the class applied to menu links when they are a parent of any given page (including category archives).

    Posted 8 years ago #
  9. A new problem arise:

    I lost the menu highlight when clicking in the footer navigation menu to show the next page for the same category. I tried mny new css class, but nothing.

    Any suggestion?

    Posted 8 years ago #
  10. I found my mistake: I was linking my menus to single posts whereas now I realize that I had to link menus to a category page to make the CSS work properly.

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.