Affichage des articles dont le libellé est Featured. Afficher tous les articles
Affichage des articles dont le libellé est Featured. Afficher tous les articles

samedi 12 novembre 2016

How to Automatically Link Featured Images to Posts in WordPress



Recently one of our readers asked if it was possible to automatically link featured images to blog posts in WordPress. Most WordPress themes link featured images to posts by default, but some themes may not do that. In this article, we will show you how to automatically link featured images to posts in WordPress.


Automatically link featured images to posts in WordPress


Why Link Featured Images to Posts in WordPress?


Images are more engaging than text. Using featured images can boost user engagement on your site.


Usually, featured images are large and take more space than text. They are more colorful, hence more noticeable. They are also easier to click on smaller devices like mobile phones and tablets.


List25 using featured images to engage users


However, if your post thumbnails aren’t clickable, then it makes it harder for users to view your post.


Most WordPress themes link featured images to the posts by default. Some themes may not use that approach, which makes it difficult for you to properly utilize featured images.


Having said that, let’s see how you can automatically link featured images to posts in WordPress.


Automatically Link Featured Images to Posts in WordPress


This method required you to add code into your WordPress files. See our beginner’s guide on pasting snippets from web into WordPress.


Simply add this code to your theme’s functions.php file or a site-specific plugin.



function wpb_autolink_featured_images( $html, $post_id, $post_image_id ) {
$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>';
return $html;
}
add_filter( 'post_thumbnail_html', 'wpb_autolink_featured_images', 10, 3 );

This code simply adds a link around the code generated to display featured images or post thumbnails on your website.


This code will also add a link around featured images on single post pages. If you don’t want to link featured images on single post to the same post, then use this code.



function wpb_autolink_featured_images( $html, $post_id, $post_image_id ) {

If (! is_singular()) {

$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>';
return $html;

} else {

return $html;

}

}
add_filter( 'post_thumbnail_html', 'wpb_autolink_featured_images', 10, 3 );


We hope this article helped you learn how to automatically link featured images to posts in WordPress. You may also want to see our list of 14 best featured image plugins and tutorials for WordPress.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Automatically Link Featured Images to Posts in WordPress appeared first on WPBeginner.







How to get your host featured at WHSR?



alt="How to get your host featured at WHSR?" src="http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2015/04/default-image-500x308_c.jpg" />

I get requests to include a host in WHSR’s review list from time to time. But as you know, WHSR is an and I definitely can’t have y’all reviewed and listed here.

I am sorry that I cannot fulfill most of the inclusion request in my review list as WHSR is an one-man operation (hey, I need to play some href="http://sea.battle.net/sc2/en/">StarCraft 2 too!). In case you are hoping to get your hosting company listed here at WHSR, I am opening up a few extra alternatives recently and here’s how things can be done.

Web Hosting Interview

src="http://www.webhostingsecretrevealed.com/images/2011/0505-1.jpg" alt="Web Hosting Interviews" class="border" />

Most hosting providers will opt for this options as the interview posts here are often tweeted and referred by other bloggers. I believe this is the best options for new hosting company as it improve ‘brand visibility’ and you are often allow to introduce your company in details throughout the interviews.

Examples, check out my past work with href="http://www.webhostingsecretrevealed.com/featured-articles/10-questions-with-hostgator/">Hostgator, href="http://www.webhostingsecretrevealed.com/featured-articles/interview-with-trey-gardner-greengeekstigersites/">GreenGeeks, href="http://www.webhostingsecretrevealed.com/featured-articles/interview-with-ryan-morris-marketing-director-at-coolhandle/">CoolHandle, href="http://www.webhostingsecretrevealed.com/featured-articles/interview-with-hostcolor-operations-vp-martin/">HostColor, href="http://www.webhostingsecretrevealed.com/featured-articles/interview-with-wp-engine-co-founder-jason-cohen/">WP Engine, href="http://www.webhostingsecretrevealed.com/interviews/interview-with-karl-robinson-of-stratogen/">StratoGen, and href="http://www.webhostingsecretrevealed.com/interviews/interview-with-zak-boca-of-singlehop/">SingleHop.

Send Me A T-Shirt!

src="http://www.webhostingsecretrevealed.com/images/2011/0505-2.jpg" alt="Web Hosting T Shirts" class="border" />

Not long ago I did href="http://www.webhostingsecretrevealed.com/web-hosting-shopping/freebies-from-atlantic-net-six-25-coupons-to-be-giveaway/">a post for Atlantic.net when they sent me a free T shirt and some free shopping coupons. I find it’s fun doing this so I would be happy to do more. To get a free writeups about your hosting company, simply send me your company T shirt and I will write a post introducing your company with a photo of myself wearing that tee and couple of free links to your company website.

Web Hosting Coupons

src="http://www.webhostingsecretrevealed.com/images/2011/0505-4.jpg" alt="Web Hosting Coupons" class="border" />

I am opening a new section to collect hosting coupons and special discount links (hey, everyone loves special discounts and exclusive deals, right?) For now, the listing is absolutely free-of-charge. Just give your best deal to my readers and I am happy to feature your company on the page.  

Also, I am not having a lot to list right now – in other words, if you are in now, you’ll get a bigger part of the attention from that page.

To check out the coupon page, visit: href="http://www.webhostingsecretrevealed.com/web-hosting-coupons-promotion-links/">WHSR Web Hosting Coupons.

Cloud Host Listing

src="http://www.webhostingsecretrevealed.com/images/2011/0505-3.jpg" alt="Web Hosting Interviews" class="border" />

I am collecting a list of cloud hosting providers at this page: href="http://www.webhostingsecretrevealed.com/web-hosting-knowledge/a-brief-on-cloud-hosting/">A Brief On Cloud Hosting. It’s a piece of article written a few years back and it’s ranking very well in several generic, cloud host related search terms at Google (ie. href="http://www.google.com/search?q=cloud+hosting&ie=utf-8&oe=utf-8&aq=t&client=firefox-a&rlz=1R1GGLL_en___MY394&gl=us&pws=0" target="_blank">cloud hosting). At this time of writing, the page itself received around 2,800 unique visits monthly.  

For the listing, I am now charging a one-time admin fees of 0. In return, you will get banner link (your company logo, sized at 225x55px), a text link (preferably your company name) to your company website, and a short intro sentence introducing your company. Note that the fees is for life-time listing, I will not charge you anymore after the first payment but your company will be mentioned or linked from time to time in my blogposts if relevant (no promises but I do like to give more whenever possible).

A few who have enrolled in this listing include: href="http://www.cloud.bg/en/" target="_blank">Cloud.bg, href="http://www.vps.net" target="_blank">VPS Net, href="http://www.reliacloud.com/" target="_blank">Relia Cloud, href="http://www.hpchost.com/" target="_blank">HPC Host, and href="http://www.atlantic.net/" target="_blank">Atlantic.

Sounds Good? Let’s Talk.

Well that’s all for my updates. For those who have already contacted me in the past, thank you very much for your time and supports. I hope WHSR does help improve your business a little while bringing extra information to the readers.

Others, I’d LOVE to hear from you soon. Let’s talk over at jerry [a] webhostingsecretrevealed.com.

 


Page 27 – Web Hosting Secret Revealed