How to Make a Clickable External link from WordPress Featured Image Post

Posted on

If you are looking for a way to make external link clickable from your featured image this is your lucky day, because I am going to show you step by step how to do it easily.

Note: This is not a featured image that look for image from other sites ( you just put URL instead of upload picture yourself). If you are looking for this features there are many plugin doing this you can look here:
https://wordpress.org/plugins/search.php?type=term&q=external+link+from+featured+image&=Search+Plugins

Let see the picture below and you will see what I mean here:

Sample of featured image linkThe link this sample page is http://propolisobatalami.com/bowtrol-colon-cleanse-review/
OK let’s get to the point how we can add external link to featured image like above sample.

1. Change code on your theme

You need to change a code on your wordpress theme. Every theme is different but the principal is the same. On my sample here I am using Theme MH Purity lite 1.2.0 Open

Open MH function fileOpen mh-functions.php file

The original code is:

$attachment_page = get_attachment_link(get_post_thumbnail_id());

original code

Modify the code to become:

$attachment_page = get_posts_meta($post->ID, ‘ExternalUrl’, true);

code after modified

2. Add custom fields on your post

You need to add a custom fields called ExternalURL on the post you want to insert external URL. Scroll down the window of until you find custom fields. If you cannot find custom fields Click Screen options on the top right side. Make sure there is check mark on the customs Fields.

screen optionscreen option 2

After you can see custom fields on bottom area of post editor, click Enter new text

Type ExternalURL on the name field

Type your URL on the Value field, the one who will become clickable on the featured picture.

Click Add Custom Field button.
add custom field
Publish or update your post.

The result is your featured image is now link to your link, you can use affiliate link or anything.

This post was inspired from WP forum by Michael here:
https://wordpress.org/support/topic/how-to-add-an-external-url-to-a-featured-image

I hope that you like this post “How to Make a Clickable External link from WordPress Featured Image Post” please share with other If you think it’s useful.

Read: Disqus Comment on WordPress is not Working, Solved

Facebook Comments