2014-12-01, 10:27:01
A similar way I do it that also uses I18N Custom Fields is I create a custom field called "redirect" and then structure the pages so that if the parent is supposed to link to the first child, then the parent page has no content but has the URL of the first child (either root-relative or absolute) in the "redirect" field. Then in the theme's template.php file, I add the following PHP before any HTML is output:
This is also a little more flexible as you can add external links to your primary navigation too using this method.
PHP Code:
<?php
if( return_custom_field( 'redirect' ) !== '' ){
header( 'HTTP/1.1 301 Moved Permanently' );
header( 'Location: ' . return_custom_field( 'redirect' ) );
exit();
}
?>
This is also a little more flexible as you can add external links to your primary navigation too using this method.