the_post_thumbnail(“size”) returns same image for all sizes except thumbnail
the_post_thumbnail(“size”) returns same image for all sizes except thumbnail
the_post_thumbnail(“size”) returns same image for all sizes except thumbnail
How to replace featured image upload option with the post media image option
You may be able to make this work with a filter on post_thumbnail_html. function filter_thumb_html($html, $post_id, $post_thumbnail_id, $size, $attr ) { $dimensions = wp_get_attachment_image_src($post_thumbnail_id, $size); if ($dimensions[1] > 500 || $dimensions[2] > 500) { return ”; } } add_filter(‘post_thumbnail_html’,’filter_thumb_html’,1,5); I am not sure what you mean by “if it is larger/smaller…”. I don’t know if … Read more
Cleaning up bloated wp_postmeta table by removing multiple _thumbnail_id’s?
wp_get_attachment_image_src match smallest edge
Getting all the images from the post, and adding them to the top of the post is relatively easy. You can do something like this: (Note, this is just a code example. I’m not 100% what you are looking for. Hopefully this is enough to get you started.) function getImagesInThisPost() { global $post, $posts; //find … Read more
“Medium” size image displayed instead of “thumbnail” in only one post, other posts are fine
Featured image not working, because of custom user role?
Callback This is how “Reactor” hooks the callback add_action( ‘reactor_post_header’, ‘reactor_do_standard_thumbnail’, 4 ); Backtrace The function itself is hooked from where you linked ~/theme_root/library/inc/content/content-post.php but this file is called by the class Reactor. This class/file is not included during the main callback hooked to after_setup_theme in the functions.php file on priority 10, but before that … Read more
I was looking for a code snippet that will extract the URL of a post thumbnail to be used as a background image. Through research elsewhere, the best answer I found is the code snippet below: <div style=”background: url(<?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,’large’, true); echo $image_url[0]; ?>)”></div> This code sets the large thumbnail … Read more