Created
          March 23, 2013 05:32 
        
      - 
      
 - 
        
Save spencejs/5226592 to your computer and use it in GitHub Desktop.  
    Redirect To First Child Page
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| /* | |
| Template Name: redirect to first child | |
| */ | |
| if (have_posts()) { | |
| while (have_posts()) { | |
| the_post(); | |
| $pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order"); | |
| $firstchild = $pagekids[0]; | |
| wp_redirect(get_permalink($firstchild->ID)); | |
| } | |
| } | |
| ?> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment