Ever get tired of those nasty [...] ellipses that appear beneath your blog excerpts? I do. In this tutorial, I am going to show you how to change WordPress’ default excerpt display without changing core WordPress files.
Open up functions.php and add this code to the very bottom of the file:
<?php function gpp_excerpt($text) { return str_replace('[...]', '<br /><a href="'.get_permalink().'">Read More →</a>', $text); } add_filter('the_excerpt', 'gpp_excerpt'); ?>The above code “filters” WordPress’ default the_excerpt function and replaces it with our own gpp_excerpt function. We have just written a very simple plugin for WordPress.
If, however, you are writing your own excerpts and want to add a Read More permalink, replace:
<?php the_excerpt(); ?>with this:
<?php the_excerpt(); ?><span class="read_more"><a href="<?php the_permalink(); ?>">[ Read More → ]</a></span>If you found this tutorial useful, consider subscribing to Graph Paper Press. You will get access to our support forum, where additional tutorials similar to this one are available to our subscribers.
Pingback: qqqqqqqqqq « Test Industrial Blog
Pingback: Tip: How to change the default Wordpress excerpt | Tutorials and wordpress
Pingback: How to Change the [...] in Wordpress’ the_excerpt Hook | The Mighty Mo! Design Co. | Minneapolis Wordpress Developers and Designers
Pingback: Thumbnail or Nextgen gallery in excerpt « Michiel van Dijk
Pingback: An Introduction // jd french