wordpress custom function for tabs creating duplicate tabs - simple php!

Posted by user269959 on Stack Overflow See other posts from Stack Overflow or by user269959
Published on 2010-03-23T23:19:09Z Indexed on 2010/03/23 23:23 UTC
Read the original article Hit count: 206

Filed under:
//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!

© Stack Overflow or respective owner

Related posts about Wordpress