trouble with wp_list_pages
-
I am trying to edit the “page.php” file in my theme with the following code to display only the child pages of the current page-
<?php $children = wp_list_pages('title_li=Pages&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
This is taken straight off of this codex page- https://codex.www.ads-software.com/wp_list_pages
What happens though is I get two sets of unordered lists like in the below code. I want it to appear like the first set where it is only the child-pages of the current parent, but as you can see, the first url does not obey the ‘title_li=Pages’ that I put into the wp_list_pages(), the second ul does. But the second ul displays the parent, siblings and child pages. What the heck is going on?
I can get rid of the if() and then it only displays the first unordered list but that still doesn’t fix the problem of it not obeying my title_li .. HELP!?!
<ul> <li><strong><a title="Culture and fine arts" href="https://local.southerncommunityguide.com/asheville/lifestyle/culture-and-fine-arts/" target="_self">Culture and Fine Arts </a></strong></li> <li><a title="Leisure activities" href="https://local.southerncommunityguide.com/asheville/lifestyle/leisure-activities/" target="_self"><strong>Leisure Activities</strong> </a></li> <li><strong><a title="Urban Living" href="https://local.southerncommunityguide.com/asheville/lifestyle/urban-living" target="_self">Urban Living</a> </strong></li> <li><strong><a title="Events" href="https://local.southerncommunityguide.com/asheville/lifestyle/events/" target="_self">Events </a></strong></li> </ul> <p> </p> <ul> <li class="pagenav">Pages<ul><li class="page_item page-item-52"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/green-living/" title="Go Green!">Go Green!</a></li> <li class="page_item page-item-47"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/culture-and-fine-arts/" title="Culture and Fine Arts">Culture and Fine Arts</a> <ul> <li class="page_item page-item-42"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/culture-and-fine-arts/art/" title="Art">Art</a></li> <li class="page_item page-item-43"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/culture-and-fine-arts/history/" title="History">History</a></li> <li class="page_item page-item-44"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/culture-and-fine-arts/literature/" title="Literature">Literature</a></li> <li class="page_item page-item-45"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/culture-and-fine-arts/music/" title="Music">Music</a></li> <li class="page_item page-item-46"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/culture-and-fine-arts/theatre/" title="Theatre">Theatre</a></li> </ul> </li> <li class="page_item page-item-24"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/leisure-activities/" title="Leisure Activities">Leisure Activities</a></li> <li class="page_item page-item-28"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/urban-living/" title="Urban Living">Urban Living</a></li> <li class="page_item page-item-50"><a href="https://local.southerncommunityguide.com/asheville/lifestyle/nightlife/" title="Nightlife">Nightlife</a></li> </ul></li> </ul>
- The topic ‘trouble with wp_list_pages’ is closed to new replies.