Jump to content

Add Read More to Manual Excerpt on Wordpress


driverm

Recommended Posts

Hello,

I have a wordpress site using Thesis 2.1 theme and I am displaying "excerpts" for each post on homepage.. I don't want to add <!-- more --> to each post and I want to show sth different, sth more valuable on the homepage to my readers.. Thats why I use excerpts.

 

I added this line of code to my custom.php file:

function new_excerpt_more($more) {global $post;return ' <a href="'. get_permalink($post->ID) . '">Continue Reading...</a>';}add_filter('excerpt_more', 'new_excerpt_more');

It added a "continue reading.." link to the posts that I haven't yet defined excerpt.. So, If nothing is written on the excerpt area of that post, it shows some part of the post and adds a "continue reading.." link to it on the homepage. But if I have written sth in the excerpt area of the post, it does shows the excerpt, but doesn't add the "continue reading.." link at the end..

I will be happy if you may help me on this, this drives me nuts currently! [/size]smile.gif

 

MERGED

 

So basically, what I am trying to do is, adding read more tag to custom excerpts which we define manually.

Here is another code I tried but had no luck again!

//* Changing excerpt more - only works where excerpt IS hand-craftedfunction manual_excerpt_more( $excerpt ) {	$excerpt_more = '';	if( has_excerpt() ) {    	$excerpt_more = ' <a href="' . get_permalink() . '" rel="nofollow">[Read more]</a>';	}	return $excerpt . $excerpt_more;}add_filter( 'get_the_excerpt', 'manual_excerpt_more' );

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.