WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic menu highlighting of multiple subcategories (1 post)

  1. Skinny_Latte
    Member
    Posted 5 years ago #

    I am using dynamic menu highlighting as suggested in the wordpress codex.

    It is working on almost all of my pages (categories and post pages within those categories). However, I have a portfolio section with multiple sub categories and I cannot get the single posts within these subcategories to highlight the main portfolio link.

    Here is what I mean. I have a top level menu link of 'portfolio'. Within that there are subcats of web design, graphic design etc etc

    when I am in a post of one of the subcategories or the portfolio link itself I want the portfolio link to be highlighted. This is the code I am using:

    <li<?php
                   if (is_page('portfolio') || is_category(array('5','6','9','16'))
                    {
                    echo " id=\"current\"";
                    }?>>
                    <a href="<?php echo get_settings('home'); ?>/portfolio/">portfolio</a>
            </li>

    Number 5 is the portfolio category, 6, 9 and 16 are the subcategories. This is giving me an error. I can sort of see why....but I don't know how to correct it. Would I need to use an elseif statement within this particular list item?

    Any help would be hugely appreciated!

Topic Closed

This topic has been closed to new replies.

About this Topic