I am editing publish-template.php in Wordpress. The function start_el echoes recption menus. Here I wish to see if the page is really a top level page in order to give a new class known as "top" only to the peak level pages li. How do you see if the page/link is really a top level one or otherwise? I want only this when i can perform the relaxation.

I have attempted with

if ($page->post_parent) { do_something(); }

however it does not work...

(I have already transformed within the same class with success the classes' names current_page_item and current_page_ancestor, current_page_parent to current since i have make use of a custom jquery menu that utilizes these kinds.)

Thanks!

Hi if you wish to add class to the peak level pages with jQuery then make a move


$('ul#main-menu>li').addClass('top_level');

here's ul#primary-menu is the menu ul id