Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // the intention with this script is to facilitate auto page generation when a new multisite instance is
- // created and the theme is activated
- function recreate_page($post_data, $meta_data, $page_num=0) {
- global $niche_settings_setting;
- // Delete the post if it already exists
- if (($page = get_page_by_title($post_data['post_title']))) {
- wp_delete_post($page->ID, true);
- }
- // Insert the post into the database and set post meta data
- $id = wp_insert_post($post_data);
- if ($id) {
- foreach ($meta_data as $meta_key=>$meta_value) {
- update_post_meta($id, $meta_key, $meta_value);
- }
- }
- }
- //////////////////////////////////// Create post object
- $my_post = array(
- 'post_title' => 'Teacher',
- 'post_content' => '<h2>Teacher Page Content</h2>',
- 'post_status' => 'publish',
- 'post_type' => 'page',
- 'page_template' => 'teacher.php'
- );
- // Post meta data
- $my_post_meta = array(
- 'custom_page_title'=>'Do You Have Back pain?',
- 'enable_conditions'=>'on',
- 'display_optin'=>'on',
- '_genesis_layout'=>'full-width-content'
- );
- recreate_page($my_post, $my_post_meta, 1);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement