Posted By

Wiederkehr on 03/07/08


Tagged

pages wordpress


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

m00min
tmbrenneke


Wordpress: Forwarding section pages to their first sub-page


 / Published in: PHP
 

URL: http://www.tom-carden.co.uk/2008/02/08/artnano-wordpress/#more-711

This snippet is originally from Tom Carden. All due credit goes to him.

  1. <?php
  2. /*
  3. Template Name: Redirect To First Child
  4. */
  5. if (have_posts()) {
  6. while (have_posts()) {
  7. the_post();
  8. $pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order");
  9. $firstchild = $pagekids[0];
  10. wp_redirect(get_permalink($firstchild->ID));
  11. }
  12. }
  13. ?>

Report this snippet  

You need to login to post a comment.