WordPress Page Hierarchy – Custom Page List Style-1

If you want to like below kind of page listing.

parent-page1
Display all child pages list of current page.

You can customize that whether you want to display all child page or only 1st level child.

 

 

 

 

 

 

 

 

 

This is the admin structure.

parent-page-2

$first_parent = get_page($parent[0]);
$parent_id = $first_parent->ID;
$parent_count = count($parent);
global $post;

$mypages = get_pages( array( 'child_of' => $parent_id, 'parent' => $parent_id, 'sort_column' => 'menu_order') );
if($mypages)
{ ?>

{$class ="activeli";}else{$class ="";}
if(get_field('page_custom_link',$page->ID))
{
$page_link = get_field('page_custom_link',$page->ID);
$target1 = 'target="_blank"';
}
else
{
$page_link = get_page_link($page->ID);
$target1 = '';
}
?>
>

if ($mypages2)
{
?>

{$current_class ="activeli";}else{$current_class ="";}
if(get_field('page_custom_link',$page2->ID))
{
$page_link1 = get_field('page_custom_link',$page2->ID);
$target1 = 'target="_blank"';
}
else
{
$page_link1 = get_page_link($page2->ID);
$target1 = '';
}
?>

>
'parent' => $page2->ID,
'sort_column' => 'post_date',
'sort_order' => 'desc'
));
if ($mypages3)
{ ?>

{$current_class ="activeli";}else{$current_class ="";}

if(get_field('page_custom_link',$page3->ID))

{

$page_link2 = get_field('page_custom_link',$page3->ID);

$target1 = 'target="_blank"';

}

else

{

$page_link2 = get_page_link($page3->ID);

$target1 = '';

}

?>
>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s