Jump to content

Help Looping Child Link Population


pjm06200

Recommended Posts

I am trying to create a dynamic loop on my wordpress site, where a parent page generates a column view of links to its sub pages.

 

I have been sucessfull in getting the links to populate with the correct name - $child->post_title - but I can only get the links to open the parent page. I have highlgted the code where i am having issues in red

 

Any assistance anyone can offer would be greatly appreciated.

 

<table class="variety_container"><tr>

<?php

$child_count=0;

echo "<td>";

foreach ($children as $child) {

//echo "child count is ". $child_count;

$new_col = $child_count > $children_per_col;

if ($new_col) {

echo "</td><td>";

$child_count=0;

}

$link = get_page_link( $page->ID + $child );

 

echo "<a href=$link>" . $child->post_title . "</a>";

 

echo "<br>";

$child_count++;

}?>

</tr></table><!--variety container-->

Link to comment
https://forums.phpfreaks.com/topic/274448-help-looping-child-link-population/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.