Forum Replies Created

Viewing 1 replies (of 1 total)
  • I looked for this all over. i was even using a redirect php script for a while but it is intended for using your main page links for linking to external links.

    Here is the way to redirect to a sub page.
    using the code in the link above, im just elaborating on the steps.

    1) Create a new template file and paste the following code into it.

    <?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));
      }
    }
    ?>

    2) save and upload your new template into your theme directory.

    3) Edit your Parent page and apply the “Page Template”.

    Note: adding the page template is located down towards the bottom of the page. i also found it helpful to put a note in the body of the page form so that whoever edits it later wont be confused when they dont see any content.

    hope this saves somebody some time!

Viewing 1 replies (of 1 total)