WordPress.org

Support

Support » How-To and Troubleshooting » conditional statement with wp_list_categories

conditional statement with wp_list_categories

  • xiabolai

    @xiabolai

    Hi,

    I have a question about where to place a conditional statement with a dropdown menu and wp_list_categories. Have searched and tried many things but nothing works.

    Here’s my site for reference: http://newsite.blairshapiro.com

    Here’s my header.php code to create a dropdown menu:

    <li>
    
              <a>Work</a>
    
                     <ul>
                         <?php wp_list_categories("exclude=$blog_ID&title_li="); ?>
        		</ul>
             </li>

    I want to highlight ‘Work’ when in one of the subcategories created by wp_list_categories and think I need to place the following conditional statement in either the “li” segment or the “ul” segment:

    <?php if(is_category){ echo ' class="current_page_item" ';}?>>

    My question is, where do i place the conditional statement and how to best style the css so ‘Work’ is highlighted when in one of the subcategories created by wp_list_categories?

    Any help would be appreciated!

Viewing 1 replies (of 1 total)
  • xiabolai

    @xiabolai

    Bump…

    Anyone? Would really appreciate any advice. I’m totally stumped.

Viewing 1 replies (of 1 total)
  • The topic ‘conditional statement with wp_list_categories’ is closed to new replies.
Skip to toolbar