ThemeShaper Forums » Thematic

[closed]

Classes to highlight menu for posts

(7 posts)
  • Started 3 years ago by alexenergy
  • Latest reply from middlesister
  • This topic is resolved
  1. My menus are related to posts with the same category and uses this to highlight the menus:

    My CSS works until I click the navigation footer to see the next post for the same category, then I lost the hover highlight on the menu. I could not find an explanation.

    I found that there are more class to highlight menus:
    (cat-item
    current-cat
    current-cat-item)

    How can I activate the classes above for sf-menu?

    Posted 3 years ago #
  2. Currently, I am using this CSS, but only works for post of the category

    .sf-menu .current-custom-item a,
    .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 {
    color:#fff;
    background: url("images/hover.gif") top left no-repeat;
    }

    Posted 3 years ago #
  3. middlesister
    Member

    What kind of menus are you using?
    You get different set of classes depending on whether you use the new menu system in WP 3.0 or use some of the other wordpress functions to generate it.

    Based on your first post I would suggest

    .sf-menu .current-cat a,
    .sf-menu .current-custom-item a,
    .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 {
        color:#fff;
        background: url("images/hover.gif") top left no-repeat;
    }

    But I see .current-menu-item as one of the selectors. This is a class that gets generated by the menu system in WP 3.0. The parents in the hierarchy gets .current-menu-parent and .current-menu-ancestor, respectively. If you are using the menus in WP 3.0 then the css would be

    .sf-menu .current-custom-item a,
    .sf-menu .current-menu-item a,
    .sf-menu .current-menu-parent a,
    .sf-menu .current-menu-ancestor 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 {
        color:#fff;
        background: url("images/hover.gif") top left no-repeat;
    }
    Posted 3 years ago #
  4. I working to solve the problem by redirecting the category page to a single post

    Posted 3 years ago #
  5. Middlesister, I tried before .sf-menu .current-cat, but it did not work neither for the following posts, only works for the first.

    Finally I solved the problem by using categories in the menu and redirect them to the first post of its category.

    I used the plugin Category Redirect to Post/Page.

    Posted 3 years ago #
  6. middlesister
    Member

    Ok, maybe I just didn't understand what you were trying to do. Glad that you found a solution anyway. :)

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.