BITCOIN, LITECOIN

Last week I discussed how to add featured image to a blog post. Then, a client called us to ask if it is possible to add more than one featured image. So, I decided to share the result of the research work we (Frandimore staff) did on it.

On feature image enabled themes, WordPress provides only one box to set it on the right side of post editor which cannot accommodate more than one image. So, to set another one, you have to also enable it on your theme. For this to work, it has to be done via plugin unlike the one that could be enabled on the theme.

To do this, the first thing you need to do is install a plugin called ‘Multiple Post Thumbnail‘. Activate it. That’s not all. You need to insert the code below to your Funtion.php file for the other box called ‘Secondary featured image’ to show on the post editor below the first box.

if (class_exists('MultiPostThumbnails')) {
    new MultiPostThumbnails(
        array(
            'label' => 'Secondary Image',
            'id' => 'secondary-image',
            'post_type' => 'post'
        )
    );
}

That is where you’ll be able to set the second image anytime you compose a post. Multiple thumbnail

However, the second image will not still show on the front-end until you add the code below on the page(s) where you want it to show.

<?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail( get_post_type(), 'secondary-image' ); endif; ?>

Ideally, you might want to insert this code in either the category.php, archive.php or singlepost.php files. Place it exactly where you want it to show.

That’s all you need to do to add another featured image to your website.

Let’s now look into these questions below critically.

Of what use is the second featured image when you can actually add another illustrative image within the body of the post.

Also, what is the need for the second image on the category or archive page that just stay dome without adding any value to the visitor or reader and the website?

These questions propelled me to go a little deeper in our research to justify the addition of the second image in terms of beauty and usability.

To make the second image worthwhile, I needed to make it clickable to a custom URL and probably with some text. With that I would be able to promote certain services or affiliate product links that are related to the post content within the archive or category page.

featured image captionTo achieve this goal, I installed yet another plugin called ‘Feature Image Caption‘. The plugin will automatically place a small box within the menu function beside the post editor. This box will allow you set caption with custom URL on the featured image used for a particular post.

Note: The default caption and description box on media gallery doesn’t work on featured image. This is another reason why you might need this plugin.
This caption is good for image attribution, but I needed something more than that.

So, I composed an HTML that contain an image with custom URL and place it within the caption text box because I’d known that WordPress caption box can interpret HTML components.

Lo and behold, it gave me the exact solution I needed with additional option for clickable text.

However, there is a code below you need to insert on the page where you want it to show up. For us, we placed it on the archive page below the post excerpt.

<?php cc_featured_image_caption(); ?>

Conclusion: Anything is really possible with WordPress. You just need to go a step further in your research work to get what you want. Just like Android, WordPress has countless plugins that can help boast your sense of creativity.

But remember, too many plugin can slow down the load time of your website. Therefore, it is imperative to use them only when you do not have alternative code to bring about the experience you want to create.

Photo Credit: Ayudawp

Francis 'Toke

Creative Web Developer at Frandimore
Level headed individual, writing blog post for Frandimore when not engrossed on projects.
Share This