jimmyt1988
Member
Posted 2 years ago #
Hi all,
I have been struggling for 45 mins trying to get this right.
On my index page I have a side div that will list sub pages (child pages) of the current page (the parent page).
Unfortunately I have no idea how to do that.
I also will need to wrap some divs around each li.
<div id = "leftLinks">
<div class = "wrapButton">
<div class = "top"></div>
<div class = "middle">
<ul><li><a href = "">SUB LINK GOES HERE</a></li></ul>
</div>
<div class = "bottom"></div>
</div>
<div class = "wrapButton">
<div class = "top"></div>
<div class = "middle">
<ul><li><a href = "">SUB LINK GOES HERE</a></li></ul>
</div>
<div class = "bottom"></div>
</div>
</div>
jimmyt1988
Member
Posted 2 years ago #
Fortunately, I finally found this:
<?php
$children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
if ($children) { ?>
<?php echo $children; ?>
<?php } ?>
Unfortunately I now need to wrap my extra div parts around each link?
How do I go about doing this?
jimmyt1988
Member
Posted 2 years ago #
Now I have:
<?php
$children = wp_list_pages('title_li=$before=<div class = "wrapButton"><div class = "top"></div><div class = "middle">&child_of='.$post->ID.'&echo=0'.'$after=</div><div class = "bottom"></div></div>');
if ($children) {
echo $children;
}
?>
But it only prints out the code that is in $before. It just skips off $after?
jimmyt1988
Member
Posted 2 years ago #
AHHH.. Sussed it.
For record sake.
wp_list_pages('title_li=before=text text text&after=text text text')