Hi everyone,
I'm working on a site that has child pages, and I'm needing to use them as links on a menu. I'm using wp_list_pages() for that.
However, when I click a child page link, it will display the top level menu instead. So, having looked through the Function Reference I found is_page() and used the following code to get the correct page IDs:
$aboutchildren=get_pages("child_of=53");
$aboutlinks.=53;
foreach($aboutchildren as $child) :
$aboutlinks.=",".(integer) $child->ID;
endforeach;
if(is_page(array($aboutlinks))) :
//put the links for the about page here...
else :
//put main links.
endif;
Just to explain, 53 is the ID of the top level About page. However, event though the correct IDs are being passed in the $aboutlinks array, the code doesn't pick it up - it ONLY works if I literally write the array by hand (i.e. is_page(array(1,2,3,4,5)) etc.). Is there a reason why this won't work? I really don't want to have to hard code the IDs, in case they change or more pages are added.
Any help on this would be greatly appreciated.
Thank you
Michael