tags:

views:

10

answers:

1
//checks that we are on current page and highlights tab as active if so
    if(is_page($page_name)){
        echo " <li><a href='$href' class='current_page_item'> $tabname</a></li>";
    }
    else {  
    }

    if(is_single() && $singlelight=="this_one") {
        echo " <li><a href='$href' class='current_page_item'> $tabname</a></li>";
    }
    else {
        echo " <li><a href='$href' > $tabname</a></li>";
    }

this code works as i would expect to highlight tabs using the wordpress function is_single and is_page. the problem is it generates 2 tabs for the active one in the menu. so my menu looks like this when 'home' is active.

Home Home Faq Blog Contact

Appreciate any help thanks!

A: 

Do you need the first if statement?

What if you tried:

    if(is_single() && $singlelight=="this_one" && is_page($page_name)) {
        echo " <li><a href='$href' class='current_page_item'> $tabname</a></li>";
    }
    else {
        echo " <li><a href='$href' > $tabname</a></li>";
    }
Kevin
that eliminates my duplicate tabs but the 1st if statement checks against is_page to highlight the tab. so no highlighting with this code which is the point of the function.
Okay, I edited it. Try that. What does is_single() do?
Kevin