pifa

Child Redirect

Nov 13th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.27 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Child Redirect
  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. ?>
Advertisement
Add Comment
Please, Sign In to add comment