How to create an external link on a WordPress post title? Do you want to add a link to an external source on the title of your WordPress post?

Sometimes you might want to share a link with your users. Instead of sending them to the article, you'll want the article title to be a connection to the source you want to share.

In this tutorial, we'll show you how to link to other sources from the title of your WordPress posts.

But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog 

Then back to why we are here.

Method 1: How to create a link to an external source on the title of your articles with a plugin

This method is easier and is recommended for beginners.

The first thing you need to do is install and activate the plugin Page Link To. For more details, see our step-by-step guide on way to install a WordPress plugin.

After activating the plugin, you will only need to create an article or modify an existing one. You will notice a new “Link page to” meta box, in the sidebar

Click on " A Custom URL To add the link you want to add to the article title. Now you can save or publish your article.

So much to see... 5 WordPress plugins to save your blog

That's all. The article title will now link to the custom URL you provided.

This method is not just for external links. You can also use it to send users to different posts and pages in your WordPress blog.

Method 2: How to link to another source manually

This method requires you to add code on WordPress. You can use this method if you know how create a WordPress plugin for example.

So just add this code to functions.php file of your theme or in your WordPress Plugin.

function print_post_title() {
global $post;
$thePostID = $post->ID;
$post_id = get_post($thePostID);
$title = $post_id->post_title;
$perm = get_permalink($post_id);
$post_keys = array(); $post_val = array();
$post_keys = get_post_custom_keys($thePostID);

if (!empty($post_keys)) {
foreach ($post_keys as $pkey) {
if ($pkey=='external_url') {
$post_val = get_post_custom_values($pkey);
}
}
if (empty($post_val)) {
$link = $perm;
} else {
$link = $post_val[0];
}
} else {
$link = $perm;
}
echo '<h2><a href="'.$link.'" rel="bookmark" title="'.$title.'">'.$title.'</a></h2>';
}

This code appears to be looking for a custom field containing your custom url. If the article has the custom field, it uses the title of the article linked to your URL.

Discover How to add a custom login URL to WordPress

The next step is to replace the default title display on your theme. You will find it in the following files archives.php, content.php, category.php and other templates. You will find something similar to this:

<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>

You must replace it with this code:

<?php print_post_title() ?>

The code part is done, now you need to add the external url to the article. All you have to do is edit an article or create a new one. On the text editor page, navigate to custom fields.

See also How to put your WordPress website in Maintenance mode

If you can't see the custom fields section then you need to click on Screen Options and you need to check " Custom Fields"

How to create an external link on an article title

When the custom fields area is displayed, you must then click on " Enter a new one"

How to create an external link on an article title

Come in " external_url »As the value of the field, then define the URL address to which you want to link. And that's all.

Discover also some premium WordPress plugins  

You can use other WordPress plugins to give a modern appearance and to optimize the handling of your blog or website.

We offer you here some premium WordPress plugins that will help you do that.

1. Smart Podcast Player

Smart Postcast Player is designed for podcasts. This WordPress audio player plugin is a premium product. It can easily manage your entire media library using the player Smart Track for an entirely unique show.

smlart podcast player.jpg

This way you can use it for music, podcasts or even just so that your visitors can download media on an ad hoc basis.

You can even capture the email addresses of listeners through your mailing list.

Download | Demo | Web hosting

2. WP Ultimate Social

This is an ultimate pack of all the social networking features you may need on your WordPress blog.

wp-ultimate-social

Its main features are: several social network icons, social sharing which allows anyone to share the content of your website (articles, pages, images, media) on popular social networks (Facebook, Twitter, Linkedin, GooglePlus, Pinterest, Digg, Buffer, Reddit, Tumblr, Stumbleupon, Xing, Weibo, VK, Delicious), the connection to the website with your social network credentials, a counter to display the numbers of your followers, and of shares of your website and others.

Download | Demo | Web hosting

3. WooCommerce PDF Invoice, Packing Slip & Shipping Label

Le WordPress Plugin WooCommerce PDF Invoice automates the creation of PDF invoices, packing slips, and shipping labels. It allows your staff to save time, by making them ignore the tasks of copying the details of the order and sending it manually to the customer.

Woocommerce pdf invoice packing slip shipping label

You will have the possibility to select an invoice template among the 6 available, to personalize it, and to add the name of the company, the address and the logo.

Find out in our next article How to add a query monitor to WordPress

It is very flexible and offers many other features that you can discover by trying its demo.

Download | Demo | Web hosting

Recommended Resources

Find out about other recommended resources to help you build and manage your website.

Conclusion

Here! That's all. We hope this tutorial helps you link to other sources on your WordPress blog. Feel free to share this tutorial with your friends on your favorite social networks

However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation.

If you have suggestions or remarks, leave them in our section Comments.

...