Ready to get started?Download WordPress


Menu issue for months, no answer yet...Anybody? (6 posts)

  1. xiabolai
    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. However, I have a portfolio section called 'Work' with multiple sub categories and I cannot get the subcategories and single posts within these subcategories to highlight the main portfolio 'Work' link.

    Here is what I mean. I have a top level menu link of 'Work'. Within that there are subcats of interactive, print, outdoor, etc, etc.

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

                   if (is_category(array('interactive','microsite','email','print'))
                    echo " id=\"current\"";
        			<?php wp_list_categories("exclude=$blog_ID&title_li="); ?>

    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?

    Here's the site: http://newsite.blairshapiro.com

    Any help would be hugely appreciated!

  2. iridiax
    Posted 5 years ago #

    if (is_category(array('interactive','microsite','email','print'))

    The above has a missing )

    I always use this general format so that I can use regular code:

    <?php if (is_category('a')) { ?>
    <!-- code here -->
    <?php } elseif (is_category(array('b','c'))) { ?>
    <!-- code here -->
    <?php } elseif (is_category('d')) { ?>
    <!-- code here -->
    <?php } else { ?>
    <!-- code here -->
    <?php } ?>
  3. iridiax
    Posted 5 years ago #

  4. xiabolai
    Posted 5 years ago #


    Thanks for the response. I'm somewhat of a newbie, and not sure I understand how to implement your suggestion, or the codex examples which look like they may be right on target.

    Any way you can show me an example of exactly what the code might look like to achieve my goal?

  5. iridiax
    Posted 5 years ago #

    If it were me, I would style li.current-cat and li.current-cat-parent in my theme's style.css. I'm not sure what could do on individual post pages since these are not categories, probably something with in_category and current_category in wp_list_categories.

  6. xiabolai
    Posted 5 years ago #

    Thanks for the reply.

    So if I use the css route, I don't have to do anything to the php?

Topic Closed

This topic has been closed to new replies.

About this Topic