Last active
July 14, 2018 16:20
-
-
Save bacalj/bfd3c41b6d336d516dea5126b50ee0eb to your computer and use it in GitHub Desktop.
Filtering post_thumbnail_html - wrap it with a link to image src so image plugins pay attention
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function smith_add_link_to_post_thumbnail_html($html, $post_id, $post_thumbnail_id, $size, $attr) { | |
$myurl = get_the_post_thumbnail_url($post_id, 'full'); | |
$openlink = '<a href="' . $myurl . '">'; | |
return $openlink . $html . '</a>'; | |
} | |
add_filter('post_thumbnail_html', 'smith_add_link_to_post_thumbnail_html', 99, 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment