Sunday, November 22, 2015

Custom Excerpt Length content and Readmore Link

WordPress automatically displays the first 55 words from the post content and add [...] at the end

insert this code into function.php in your theme



function custom_excerpt_length( $length ) {
      return 180; //change this value
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );


function new_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Readmore</a>'; // change your word
}
add_filter('excerpt_more', 'new_excerpt_more');

No comments:

Post a Comment