is_tree submenu highlighting
-
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 https://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
if(is_page()&&($post->post_parent==$pid||is_page($pid)))
return true; // we’re at the page or at a sub page
else
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 57Can you give me a clue as to what I’m doing wrong?
- The topic ‘is_tree submenu highlighting’ is closed to new replies.