Find out if a page has no parent

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.

Read More

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?

Related posts

Leave a Reply

1 comment