I found on another thread how to redirect a parent page to a first child page. I used the code, but it gives me some error.
Parse error: parse error in C:\xampplite\htdocs\wordpress\wp-content\themes\AID INDIA website\page.php on line 41
I am not a php programmer, so please help. This is the code in my page.php:
<div id="container">
<?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");
if ($pagekids) {
$firstchild = $pagekids[0];
wp_redirect(get_permalink($firstchild->ID));
}
}
}
?>
<div class="post">
<h2><?php the_title();?></h2>
<div class="entry">
<?php the_content(); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
<?php edit_post_link('Edit','<p>','</p>'); ?>
</div>
</div>
<?php endwhile;?>
<?php else: ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php_e('Not Found'); ?></h2>
</div>
<?php endif;?>
</div>
<?php include (TEMPLATEPATH . '/sidebar2.php'); ?>
</div>