/ Published in: PHP
Simply replace 'Page Title' with your desired page title to automatically create the page when your theme is activated. Thanks to MattStrange for the original concept.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Automatically Create Page When Theme Is Activated $page_check = get_page_by_title('Sermon Media'); $page_check_id = $page_check->ID; 'post_type' => 'page', 'post_title' => 'Sermon Media', 'post_status' => 'publish', 'post_author' => 1, ); wp_insert_post($new_page); $new_page_data = get_page_by_title('Page Title'); $new_page_id = $new_page_data->ID; update_post_meta($new_page_id, '_wp_page_template','page-template.php'); }
URL: http://graphicriver.net/forums/thread/create-a-new-page-upon-theme-activation/33238?page=1