Skip to content

Instantly share code, notes, and snippets.

@wpflippercode
Created September 27, 2016 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpflippercode/4af234bf9f31c2e350ab5740bc86c6ef to your computer and use it in GitHub Desktop.
Save wpflippercode/4af234bf9f31c2e350ab5740bc86c6ef to your computer and use it in GitHub Desktop.
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
Copy link
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