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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?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