Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modify Featured Image markup in posts listing using wp posts pro plugin.
/**
* 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;
}
@wpflippercode

This comment has been minimized.

Copy link
Owner Author

wpflippercode commented Sep 27, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.