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' );

Edited by Ch0cu3r
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.