Created
September 27, 2016 10:56
-
-
Save wpflippercode/4af234bf9f31c2e350ab5740bc86c6ef to your computer and use it in GitHub Desktop.
Modify Featured Image markup in posts listing using wp posts pro plugin.
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
/** | |
* Modify featured image html. | |
* @param string $thumbnail Default featured image markup. | |
* @param int $post_id Post ID. | |
* @param int $thumbnail_id Attachment ID. | |
* @return string Modified featured image markup. | |
*/ | |
function wpp_thumbnail_html( $thumbnail,$post_id, $thumbnail_id) { | |
$image_attributes = wp_get_attachment_image_src( $thumbnail_id,'thumbnail' ); | |
if ( $image_attributes ) { | |
$thumbnail = '<img src="'.$image_attributes[0].'" width="'.$image_attributes[1].'" height="'.$image_attributes[2].'" />'; | |
} | |
return $thumbnail; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can modify featured image markup using this hook. You can add your own class or modify size of the featured image.
You need to paste above code in functions.php of your activated theme.