Get permalink to first child page
-
I’m using one template for the front of several exhibits. From these pages I need to link directly to the first child of each exhibit, using a “Start Here” link.
I’ve found a couple solutions to this, but none have worked, such as this one on stackoverflow:
<?php if ($children = get_children('post_type=page&numberposts=1')) { $first_child = $children[0]; $first_child_permalink = get_permalink($first_child->ID); echo '<a href="' . $first_child_permalink . '">Start Here</a>'; } ?>
It looks right. What’s wrong? Any other ideas?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Get permalink to first child page’ is closed to new replies.