groups

name language licence
featured sliding content PHP BSD
How to change the default Wordpress excerpt PHP BSD
Display an External RSS Feed PHP BSD
WORDPRESS STATIC HTML TEMPLATE PHP BSD
CUSTOM TEMPLATES FOR POSTS IN WORDPRESS PHP BSD
WORDPRESS: LATEST POSTS FROM CATEGORY PHP BSD
Better more link PHP BSD
WORDPRESS INCLUDE PAGE CONTENT PHP BSD

< 1 2 >



language: PHP
licence: BSD

How to change the default Wordpress excerpt

options: view full snippetsend to code collector
//Tip: How to change the default Wordpress excerpt

//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(); ?>

	
(Continues...)