WP read more

index.php<?php read_more(10); ?>.... <a href="<?php the_permalink(); ?>">read more</a>

functions.php
function read_more($limit){
$contents = explode(' ', get_the_content());
$less_contents = array_slice($contents, 0, $limit);
echo implode(" ", $less_contents);

}

Comments

Popular posts from this blog

Deploy laravel application to digital ocean droplet

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine