Jump to content

Wordpress - List child pages and parent page?


ttmt

Recommended Posts

Wordpress - List child pages and parent page?

 

Hi all

 

This is the 3rd day on this now, it's driving me mad.

 

I'm trying to create a Wordpress photo gallery theme, I want a gallery with sub sections.

 

http://www.ttmt.org.uk/wordpress/

 

In the demo I have 'Transport' with the sub sections Boats and Cars.

 

I have 3 pages - Transport, Boats and Cars. Boast and Cars are child pages of Transport.

 

Each page has a NextGen Gallery as it's content.

 

When you click Transport the gallery loads and the child pages are shown in a list above.

 

The child pages are added with this:

 

<?php

    if($post->post_parent){
    	$children = wp_list_pages("title_li=&include=".$post->post_parent."&echo=0"); 
    	$children .= wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); 
    } 
    
    else { 
    	$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); 
    }

    if ($children) { 
    	echo '<ul class="submenu">';
    		echo $children;
    	echo '</ul>';
    }
    ?>

 

How can I add the actual page 'Transport' to this list?

 

If you click on Boats or Cars 'Transport' is added to the list, this because it is then a parent.

 

How can I have a sub menu of Transport, Boats, Cars when 'Transport' is clicked?

 

ANY help with this would be greatly appreciated.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.