I know of themes that automatically create pages when they are installed. And the same with plugins...I'd like to know how i can do this for the theme I am creating.
I know of themes that automatically create pages when they are installed. And the same with plugins...I'd like to know how i can do this for the theme I am creating.
You'll want to use wp_insert_post. That will let you generate any post/page you'd like, and will return the ID so you can update other options (like static front page, for example).
you can create in this way
// Create post object
$my_post = array(
'post_title' => 'your post title',
'post_content' => 'Your Post content or shortcode.',
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array(8,39)
);
// Insert the post into the database
wp_insert_post( $my_post );
You must log in to post.