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.
To which “functions.php” file should this code be added? To the one in “wp-includes” or the one in the theme folder?
You make the changes on the functions.php file in your theme folder. You should never touch the WordPress files, unless you are a serious developer.
To which “functions.php” file should this code be added? To the one in “wp-includes” or the one in the theme folder?
You make the changes on the functions.php file in your theme folder. You should never touch the WordPress files, unless you are a serious developer.
Great–I’ll give it a try. Thanks!
Great–I’ll give it a try. Thanks!
Very useful tips, thank you.
Very useful tips, thank you.
Cool…thank you! Super easy, and it works! Now to make a widget that will do it… 🙂
Cool…thank you! Super easy, and it works! Now to make a widget that will do it… 🙂
thanks, works like a charm, now my issue is to add post pic!
thanks, works like a charm, now my issue is to add post pic!
I am not too good in coding. Now as you have told this function but can you also let know how we can change or customize the theme our way. Like if we want the menu bar to be in different way..
I am not too good in coding. Now as you have told this function but can you also let know how we can change or customize the theme our way. Like if we want the menu bar to be in different way..
Nice one, works a dream. Thank you.
Nice one, works a dream. Thank you.
This is simple but useful tips, thanks.
This is simple but useful tips, thanks.
What a great site for info, I am a novice, The info gained here I can put in my log and reuse in time.Thank you
What a great site for info, I am a novice, The info gained here I can put in my log and reuse in time.Thank you
As I learn more I will always remember that I started here. Thank you for all the info I can put it to use in my business plan.Our site please check us out
As I learn more I will always remember that I started here. Thank you for all the info I can put it to use in my business plan.Our site please check us out
Thank you for all the info
Thank you for all the info
Thanks for the nice information
Thanks for the nice information
thanks for your article
it is a nice blog
thanks for your article
it is a nice blog
This is very detailed. Thanks for teh screenshots.
This is very detailed. Thanks for teh screenshots.
share this issue with us, thank you to my friends. Have very good information on this site.
good work
share this issue with us, thank you to my friends. Have very good information on this site.
good work
The community using, supporting and developing WordPress just has soooo much to offer. Simple things like this is a real treat to non-developer types like me, and to have figured it out on my own (using another platform without the enthusiast community to back it) would’ve been a big task. Thank you for saving us time (and indirectly, money)!!!
The community using, supporting and developing WordPress just has soooo much to offer. Simple things like this is a real treat to non-developer types like me, and to have figured it out on my own (using another platform without the enthusiast community to back it) would’ve been a big task. Thank you for saving us time (and indirectly, money)!!!
Wow, that was easy. thank you.
Wow, that was easy. thank you.
Thanks!
How can I change the tag
to something else like “read more”?
Thanks!
How can I change the tag
to something else like “read more”?
Very useful tip that will come in very handy. Many Thanks
Very useful tip that will come in very handy. Many Thanks
Please HELP!!!
I put this in the bottom of the functions.php but nothing happened so i put it up inbetween the very last arrow and question mark and my sites broken?
http://www.commercialphotographystudiowales.co.uk
it’s coming up blank and I can’t login via the /wp-admin either
I’ve looked at the function.php in my ftp software but there seems to be far more stuff in there than there was when looking at it on internet through apperance/ editor on wordpress.
please help
Thank you very much!
Please HELP!!!
I put this in the bottom of the functions.php but nothing happened so i put it up inbetween the very last arrow and question mark and my sites broken?
http://www.commercialphotographystudiowales.co.uk
it’s coming up blank and I can’t login via the /wp-admin either
I’ve looked at the function.php in my ftp software but there seems to be far more stuff in there than there was when looking at it on internet through apperance/ editor on wordpress.
please help
Thank you very much!
Thank you! That was an excellent tip.
Thank you! That was an excellent tip.
Yet another way. It’s tough to decide which to use, haha. This one does seem easy to implement tho. Thanks for the post
Yet another way. It’s tough to decide which to use, haha. This one does seem easy to implement tho. Thanks for the post
Thanks!
How can I change the tag
to something else like “read more”
Thanks!
How can I change the tag
to something else like “read more”
i will try. thnx
i will try. thnx
Yes i think these codes will be useful for me . try it soon.
Yes i think these codes will be useful for me . try it soon.
Extremely helpful, thanks so much!
Extremely helpful, thanks so much!
After my installed excerpt plugin didn’t work, I use your code and it works like charms.. thank you
After my installed excerpt plugin didn’t work, I use your code and it works like charms.. thank you
Awesome… I’ve been looking for something like this for so long… I used it and works great. Thanks so much.
Awesome… I’ve been looking for something like this for so long… I used it and works great. Thanks so much.
Hi,
I applied the span version of your recommendation and it does as you suggest EXCEPT that the original (…) is still there (and not hyperlinked).
Any suggestions?
Hi,
I applied the span version of your recommendation and it does as you suggest EXCEPT that the original (…) is still there (and not hyperlinked).
Any suggestions?
Awesome! Worked great. Thanks!
Awesome! Worked great. Thanks!
Very Very Thank, Working Perfect
Great work very useful. Thanks
Thank you for opening this topic.
Thank you so much worked great
Thanks so much!
Thank you!
Thank you. A very important issue. Is important for my research. Have a comprehensive site.
Parse error: syntax error, unexpected ‘<' in /var/www/virtual/kujo.is/htdocs/wp-content/themes/application/functions.php on line 210 trololol
Trololol? Talk to the hand.
okuduğum bir kitaptan etkilendim ve tasarım yaptım. çok başarılıydı diye düşünürken herkes beğendi. mutluyum 🙂