Redirect to random child page (4 posts)

  1. tdskate
    Posted 8 years ago #

    I need to fix this template code so it sends a visitor a php header with random child page location.

    Template Name: Redirect to Random Sub
    echo wp_list_pages('child_of='.$post->ID.'&title_li=');
    /* header('Location: '); */


  2. JeremyVisser
    Posted 8 years ago #

    It doesn't have the ability to limit itself to child pages, but the Redirection plugin can do random redirects.

  3. tdskate
    Posted 8 years ago #

    I just need a tag or function that can create an array with urls from a page's children.. does this question even make sense ?

  4. MichaelH
    Posted 8 years ago #

    Might try this untested code to get an array of IDs for pages with parents

    $pageswithparents = $wpdb->get_results("SELECT ID
       FROM $wpdb->posts
       WHERE post_type = 'page'
       AND post_parent > 0");

    Gleaned from http://codex.wordpress.org/Function_Reference/wpdb_Class

Topic Closed

This topic has been closed to new replies.

About this Topic