<?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));
}
}
}
?>
Hi there,
I am using this template on a page that I am building, but I am using the qtranslate multi language plugin, so when I click in the parent link I am always redirected to the main language child, even if on an other language. I find out it writes the URL slightly wrong: wordpress/?page_id=212&lang=se
Any ideas how to solve this?