is_tree submenu highlighting (2 posts)

  1. Chris Wetzel
    Posted 6 years ago #

    I have a double scissor-type drop menu, that wouldn't work with wp-list pages so I'm hardcodeing my navigation. The function is_tree sounded just like what i needed to fix my submenu highlighting problem... but I can't get it to work *&%$#(@! Can someone help me? Newbee WordPress guy. You can see it here at http://wereorganized.biz/.

    I pasted the is_tree function:

    function is_tree($pid) { // $pid = The ID of the page we're looking for pages underneath
    global $post; // load details about this page
    return true; // we're at the page or at a sub page
    return false; // we're elsewhere

    into my functions.php, ( this isn't excally as listed in snippit 4,but what others seeemed to be useing )then added this to the list item that contained the nested unordered list of my submenu:

    <li<?php if (is_tree('garage-cabinets')) { echo " class=\"current\""; } ?>><b>GARAGE CABINETS</b>

    I was expecting the "current" class to be added to any submenu li of garage cabinets, what I got was this error:
    Fatal error: Call to undefined function is_tree() in /home/content/77/5846477/html/wp-content/themes/modern-style/header.php on line 57

    Can you give me a clue as to what I'm doing wrong?

  2. web-r
    Posted 5 years ago #

    Hey dude,

    still struggling with this problem?

    I also ran into this problem, its because this function uses an ID instead of an name, try running <?php the_ID(); ?> to find out what id the garage-cabinets has and use it.

Topic Closed

This topic has been closed to new replies.

About this Topic