Add a custom “Read More” link for excerpts of your custom post type. This example replaces the “[…]” which WordPress automatically appends to excerpts.
This example replaces the bracket and ellipses with just an ellipses and link to the post. The link text will be “Read more”. So, it will look like this:
... Read more
You can change “Read more” to your own custom text on line 7.
In the sample below, you must replace YOUR_POST_TYPE
on line 8 with your own custom post type.
/** * Adds a custom "Read more" link to post excerpts of custom post types. * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and "Read more". */ function isa_cpt_excerpt_more( $more ) { global $post; $anchor_text = 'Read more'; if ( 'YOUR_POST_TYPE' == $post->post_type ) { $more = ' … <a href="'. esc_url( get_permalink() ) . '">' . $anchor_text . '</a>'; } return $more; } add_filter('excerpt_more', 'isa_cpt_excerpt_more');
You can remove the ellipses if you prefer. To remove the ellipses, remove this:
…
from line 9.
You can add an arrow to the “Read more” to make it look like this:
Read more -->
To add the arrow, add this:
→
after “Read more” on line 7.
Questions and Comments are Welcome