Support » Fixing WordPress » How to Automatically Create Pages ?

  • Resolved uwiuw

    (@uwiuw)


    We can create post automatically via wp_insert_post. for example
    $new_post = array(
    ‘post_title’ => ‘My New Post’,
    ‘post_content’ => ‘Lorem ipsum dolor sit amet…’,
    ‘post_status’ => ‘publish’,
    ‘post_date’ => date(‘Y-m-d H:i:s’),
    ‘post_author’ => $user_ID,
    ‘post_type’ => ‘post’,
    ‘post_category’ => array(0)
    );
    $post_id = wp_insert_post($new_post); see http://www.wprecipes.com/wordpress-tip-insert-posts-programmatically

    But how about pages ? i believe we can change ‘post_type’ => ‘post’, to
    ‘post_type’ => ‘page’

    now, can any body help how to create pages and attach it into its respective page_template ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • A careful reading of this page explains how to create pages with wp_insert_post and has a note about update_post_meta as the way to set the template:
    http://codex.wordpress.org/Function_Reference/wp_insert_post

    Thread Starter uwiuw

    (@uwiuw)

    thank you very much, i miss the note. hopefully i can help you someday ;D

    Hey There:

    I’m REALLY new at WordPress, so this may seem like an obvious question, but here goes.

    My goal is to dynamically (automatically) generate a new page based upon entries given in a Formidable Pro form. The idea is that people will come to the Website, click the Join Now button, fill out a registration form and click Submit.

    Upon the Submit button being clicked they will then be re-directed to their new page, which represents their business on our Website.

    Is there a way to do that? I looked at the link above, but my problem is how do I kick off that wp_insert_post process and have it pull in data that the end-user has input?

    Any help would be GREATLY appreciated.

    Todd

    Please post a new topic.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to Automatically Create Pages ?’ is closed to new replies.