how to set parent and child pages like a menu in wordpress??

I Finding:

php2

 

I Finding Many More Time On Google Search Engine But Never Answer any one than i will download one template that have this idea has

set to be default setting. what is this “wp_list_pages()”  wordpress pre-define functions. until i am try to this code its working fine.

here if you want to no multi child only one child page is needed means “depth=1″

syntax: wp_list_pages();

I answers:


<?php if (have_posts()):

$args = array(

'sort_order' => 'DESC',

'child_of' => $post->ID,

'post_type' => 'page',

'post_status' => 'publish'

);

$children = get_pages($args); ?>

 <div class="col-xs-12 col-sm-12 col-md-3 col-lg-3 pull-right right-menu">

 <h3 class="title">Programs</h3>

 <?php

if($post->post_parent)

$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&depth=1&sort_order=desc");

if ($children) { ?>

<nav id="nav-sub-container" class="clearfix">

<ul id="nav-sub" class="menu-innner">

<?php echo $children; ?>

</ul>

</nav>

<?php } ?>
 <?php endif;?>

 </div>

Related Posts

Advertisement

No comments.

Leave a Reply