Answer the question
In order to leave comments, you need to log in
WordPress. How to display sub-pages of child page?
Task: when hovering over the name of a page (which is a child of another page), display a list of its sub-pages (example in the picture).
Site test06.menchasha.ru .
To display child pages (without hover yet) I try this code, but it also displays parent pages:
<?php
$args = array(
'child_of' => $post->ID,
'post_type' => 'page',
'post_status' => 'publish',
'sort_column' => 'menu_order'
);
$pages = get_pages($args); ?>
<ul>
<?php foreach( $pages as $page ) { ?>
<li>
<a href="<?php echo get_permalink($page->ID); ?>" rel="bookmark" title="<?php echo $page->post_title; ?>">
<span class="title1"><?php echo $page->post_title; ?></span>
</a>
</li>
<?php } ?>
</ul>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question