1

Hay, have a basic menu looking like this

Item 1
    Item 1.1
        Item 1.1.1
        Item 1.1.2
    Item 1.2
Item 2
    Item 2.1

I'm outputting this as a list using WordPresses "wp_list_pages()" function. This is working fine. However on the pages, i am list the subpages.

So, when I'm on page "Item 1.1" it says "Other pages" and lists "Item 1.1.1" and "Item 1.1.2".

I'm using

<?php wp_list_pages( array('child_of'=>get_the_ID(),'title_li'=>'') ); ?> 

to do this.

However, i only want this to output "other pages" on the subpage. I don't want to display the "other pages" on the top level pages (like "Item 1, Item 2").

Is there a way to see if the current page is a top level page?

migrated from stackoverflow.com Feb 23 '11 at 16:49

This question came from our site for professional and enthusiast programmers.

2

http://codex.wordpress.org/Function_Reference/get_page

If post_parent is zero, you are there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.