patric-boehner
8/18/2016 - 8:29 PM

Modify The Entry Content and Entry Excerpt Read More Link

Modify The Entry Content and Entry Excerpt Read More Link

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.


//* Modify Entry Excerpt Read More Link | Display > Entry Excerpt
add_filter( 'excerpt_more', 'pb_read_more_link' );
function pb_read_more_link() {

  // Remove the horizontal ellipsis only
  return ' <a class="more-link" href="' . get_permalink() . '">[Continue Reading]</a>';

}
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.


//* Modify Entry Content Read More Link | Display > Entry Content
add_filter( 'get_the_content_more_link', 'pb_read_more_link' );

//* Modify Entry Excerpt Read More Link | Display > Entry Excerpt
add_filter( 'excerpt_more', 'pb_read_more_link' );
function pb_read_more_link() {

  /* My example output, which keeps the horizontal ellipsis
   * adds a 'Read More' button that can be styled sepretly and screen reader text.
   */
  return '... <span class="more-link"><a class="button" href="' . get_permalink() . '">Continue Reading <span class="screen-reader-text">' .get_the_title(). '</span></a></span>';

}


//* Modify the length of post excerpts
add_filter( 'excerpt_length', 'pb_excerpt_length' );
function pb_excerpt_length( $length ) {
	return 65; // pull first 65 words
}