How to set dimensions of the post thumbnails (featured images)

Add this code to your theme’s functions.php file. Images are resized by WordPress when they are uploaded. A plugin such as Regenerate Thumbnails can be used to ensure that source images have been properly generated if image sizes are changed after the initial upload. // Sets the parameters for the post-thumbnail image size // https://codex.wordpress.org/Function_Reference/set_post_thumbnail_size … Read more

how to set featured image as facebook post thumbnail

To get the desired image while sharing or posting post to facebook you have to add og:image tag inside your <head> tag. And for twitter you have > to use twitter card //Adding the Open Graph in the Language Attributes function add_opengraph_doctype($output) { return $output . ‘ xmlns:og=”http://opengraphprotocol.org/schema/” xmlns:fb=”http://www.facebook.com/2008/fbml”‘; } add_filter(‘language_attributes’, ‘add_opengraph_doctype’); //add Open Graph … Read more

The Thumbnail aspect Ratio Issue

If you want to remove the height value from your img URL, you can use this function: add_filter( ‘post_thumbnail_html’, ‘remove_thumbnail_height’, 10, 5 ); function remove_thumbnail_height( $html, $post_id, $post_thumbnail_id, $size, $attr ) { $html = preg_replace( ‘/height=\”\d*\”https://wordpress.stackexchange.com/”, “”, $html ); return $html; } This will replace the height with an empty value. Note that you can’t … Read more