Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

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

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

1 Answer 1

up vote 2 down vote accepted

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

If post_parent is zero, you are there.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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