• Can anyone figure this out?

    I want to make the navigation so that when user is on a page like about that the the navigation has class=”selected” for the about page.

    The thing is, there is no way to know what pages people are going to have, so it has to be dynamically created through the wp_list_pages if possible.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Why nobody i ever considering browsing the Codex? 🙂
    Dynamic_Menu_Highlighting

    Thread Starter phoenixd

    (@phoenixd)

    That does not help. I don’t know what the pages will be, so a conditional statement like that will not work without knowing the pages names.

    It is also possible to use the built-in feature of WP: when listing the Pages when you are on a certain Page it adds an additional class to the current Page item. You just have to add that class to your stylesheet.

    Thread Starter phoenixd

    (@phoenixd)

    That won’t work right for me. I need the additional class on the anchor not the list item. :$

    You are full of great ideas, but none of them solve my current issue. lol… Any more?

    I know I did it for a client.
    From the Codex: All list items (<li>) generated by this tag will be given the CSS class “page_item”. When wp_list_pages is called while displaying a Page, the list item for that Page will be given the additional CSS class “current_page_item”.

    Defining the different style for the current_page_item in the stylesheet will result in having that Page name visually different in the menu/pagelist… whatever.
    Isn’t it what you want?

    Thread Starter phoenixd

    (@phoenixd)

    Yes, but I need it to be on the anchor (a href) instead of the list item (li) for it to override the styling on the normal anchor for that link.

    #menu a
    {display:block; width:202px; padding:5px 18px 5px 0; color:#606060; background: url(img/sidebarbg.gif) top right repeat-y; font-size:1.8em; font-weight:normal; text-decoration:none; letter-spacing:-2px;}

    #menu a:hover
    {color:#303030; background:#f0f0f0 url(img/sidebarbg.gif) top right repeat-y;}

    #menu ul li.current_page_item:hover
    {color:#505050; background:#fafafa;}

    #menu ul li.current_page_item
    {padding:5px 18px 5px 0; background:#fafafa; border-top:2px solid #c0c0c0; border-bottom:2px solid #c0c0c0;}

    This is what I have currently, and as well as it works, it does not solve my last problem. A current page item should not have the image in the background while the rest of the links should.

    Thread Starter phoenixd

    (@phoenixd)

    I would change them all to ul li instead of a, but in IE and some other browsers you can’t have anything else have a hover effect other than normal links (a href). So my li hover won’t work on such browsers.

    Thread Starter phoenixd

    (@phoenixd)

    I got it… 🙂

    Great! Please post what you did so the next poor soul with the same problem can find it….

    Thread Starter phoenixd

    (@phoenixd)

    I changed everything to use the li rather than the a href.

    #menu a
    {display:block; width:202px; padding:5px 18px 5px 0; color:#606060; font-size:1.8em; font-weight:normal; text-decoration:none; letter-spacing:-2px;}

    #menu a:hover
    {color:#303030; background:#f0f0f0}

    #menu ul li.current_page_item:hover
    {margin: 0; color:#505050; background:#fafafa;}

    #menu ul li.current_page_item
    {margin: 0; background:#fafafa; border-top:2px solid #c0c0c0; border-bottom:2px solid #c0c0c0;}

    #menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
    }

    #menu ul li {
    margin: 0;
    padding: 0;
    list-style: none;
    background: url(img/sidebarbg.gif) top right repeat-y;
    }

    Here is the code for my menu, and you will see it a lot more when I release the theme with it. 🙂 Thanks moshu for the help.

    Thanks much. It’s always helpful to have the solution to the original problem….

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Theme Help: Navigation Question’ is closed to new replies.