Wordpress - List all pages that have children but show children than for the current page -
the tree of pages :
- teeshirts * long * big * short - sweat * hot * cold - pants - skirts
on active page (for example teeshirts) , want display parent pages , children of current page :
- teeshirts (active page) * long * big * short - sweat - pants - skirts
the children pages of sweat not display.
can me ?
thank youuuu
try this
<?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"); if ($children) { $parent_title = get_the_title($post->post_parent);?> <li><a href="<?php echo get_permalink($post->post_parent) ?>"><?php echo $parent_title;?></a></li> <?php echo $children; ?> <?php } ?>
read also,
https://codex.wordpress.org/function_reference/wp_list_pages https://wordpress.org/support/topic/wp_list_pages-parent-and-children-pages
Comments
Post a Comment