Create page with php

<?php

$page_check = get_page_by_title('My New Page');
$page_check_id = $page_check->ID;

$new_page = array(
'post_type' => 'page',
'post_title' => 'My New Page',
'post_content' => 'This is my new page',
'post_status' => 'publish',
'post_author' => 1,
);

if(!isset($page_check_id)){
wp_insert_post($new_page);
$new_page_data = get_page_by_title('My New Page');
$new_page_id = $new_page_data->ID;
update_post_meta($new_page_id, '_wp_page_template','template-video.php');
}

//This version works as an engine for creating many pages by running through one function.  The page title is used for the page template file name so: 'Audio Admin' will be tied to the template named template-audioadmin.php

$default_pages = array('Audio Admin','Video Admin');
foreach($default_pages as $page){
$page_check = get_page_by_title($page);
$page_check_id = $page_check->ID;
if(!isset($page_check_id)) lmcb_create_pg($page);
}
function lmcb_create_pg($title){
$new_page = array(
'post_type' => 'page',
'post_title' => $title,
'post_status' => 'publish',
'post_author' => 1,
);
wp_insert_post($new_page);
$new_page_data = get_page_by_title($title);
$new_page_id = $new_page_data->ID;
$lower_title = strtolower($title);
$template_file = 'template-' . str_replace(' ','',$lower_title) . '.php';
echo $template_file;
update_post_meta($new_page_id, '_wp_page_template',$template_file);
}

?>

Limit post number of words

<?php //This block is for your functions.php file

function hyp_limit_words($string, $word_limit)
{
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit)
array_pop($words);
return implode(' ', $words);
}
?>

<!-- The rest is for the archive.php file -->
<?php $shortened_content = get_the_content(); ?>
<?php echo hyp_limit_words($shortened_content,60) . ' [...]&nbsp;&nbsp;&nbsp;'; ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Read: <?php the_title_attribute(); ?>">Read Full Post</a>