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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.