Wordpress, read more with external link

Is it possible to add to any “read more” link in a Wordpress blog a link to a external site instead it links to the post?

Sometimes I’d like to link directly to an external site.

I tried adding a custom link with CSS to simulate a Read more link but this way I got two read more links (the one I add manually and the one inserted automatically by Wordpress).

Any help is much appreciated.


Check this page out:

Basically, put the external link in the third parameter of the_content.

If you want to do it differently for each post, you can store the value in a custom field and then include it.

Thank you, but if I modify it, it will be modified for all posts, right?

I never used custom fields, is it easy to set up?

Many thanks!

Yes, if you modify it, it will affect all posts.

You’ll need a little PHP know-how, but not much.

First the easy part, actually making the custom field.

If you go to where you edit your posts, scroll down a bit and you should see a box called “Custom Fields”. By default this is minimized, so click the down arrow on it’s right to show it.

Then, just add a new field by typing in a name (name it something like “external_read_more”) and enter the URL as the value. (Subsequent ones will have a drop-down where you can just choose the name so you don’t have to worry about spelling it the same every time).

Update your post and that meta data is saved.

Now you have to edit your template files. You can do this through FTP or through Appearance > Editor in the Dashboard. You’ll want to find the file that has what you want to edit. This varies by theme, but you’ll probably want a file called “single.php” or something involving post.

Somewhere in the correct file you’ll find a segment of code that says “the_content()”. It may or may not have some stuff in the ().

Somewhere before this (in a PHP area, not an HTML area) you’ll want to do this:

$external = wp_get_post_meta(the_ID(), 'external_read_more', true);

Make sure that “external_read_more” is the same thing you typed in the custom field. This will retrieve that link from the database.

Now, wherever the_content() is, you’ll want to put it like this (keep anything in the () where it is in the second one in this code):

if(!empty($external)) {
  the_content('', false);
  echo '<a href="$external">Read more...</a>
} else {

What this will do basically is if there was an external link set, it’ll show all the text you wrote then add a “read more” link at the bottom. If there wasn’t an external link, nothing is changed. You may have to do some CSS to the link and what not, but this should be a good starting point.

Thank you a lot for your detailed explanation!