Query the post which have a thumbnail
try to work this into your query: ‘meta_key’ => ‘_thumbnail_id’ http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
try to work this into your query: ‘meta_key’ => ‘_thumbnail_id’ http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
The original question uses get_tax_meta() which does not exist in WordPress core but may be a custom function created by the asker. In this case we could switch it out just as well with get_term_meta(). You could try this: class List_Category_Images extends Walker_Category { function start_el( &$output, $category, $depth = 0, $args = array(), $id … Read more
To remove all extra image sizes you use get_intermediate_image_sizes() in tandem with remove_image_size(). E.g. function remove_extra_image_sizes() { array_map( ‘remove_image_size’, get_intermediate_image_sizes() ); } add_action(‘init’, ‘remove_extra_image_sizes’); To edit the image size dropdown you can hook a custom function to image_size_names_choose filter. function filter_image_size_names_choose($size_names) { return array_filter( $size_names, function( $size_name ){ return ‘full’ === $size_name; }, ARRAY_FILTER_USE_KEY ); … Read more
Assuming you are using ImageMagick (the WP standard) as your library there is a filter called image_strip_meta which controls whether the EXIF data must be preserved. Normally you would just use a boolean to do an overall setting, but you could easily make that a function like this: add_filter (‘image_strip_meta’,’wpse239481_conditional_strip’) function wpse239481_conditional_strip { if (…condition … Read more
I don’t know if WordPress has a way to handle this or if its based on server features and the ability of PHP but I think you could achieve this by 3rd party plugins such as Smush.it if I am not mistaken due to the fact that the image needs to be converted this way.
Look at this answer by Chip Bennet – Medium / Large images sizes aren’t cropped by default ( and I also just verified on my install ). You can change the cropping of Thumbnails in Settings -> Media. It sounds like what you really need is just a new image size via add_image_size() which is … Read more
Good news for this old question, since WordPress 4.7, pdf’s thumbnail are automatically generated.
What I understood from your question is, you want to get the best seller product in each category and set its image as a category thumb. you will need to loop through all categories then you will need also a nested loop in each category for the best product in the current loop of categories, … Read more
add_filter(‘intermediate_image_sizes_advanced’, ‘filter_image_sizes’); function filter_image_sizes( $sizes) { unset( $sizes[‘thumbnail’]); unset( $sizes[‘medium’]); unset( $sizes[‘large’]); return $sizes; }
You need to define your arguments before you pass them to WP_Query, not after. Also, your meta_query should be an array of an array, not just an array This $query = new WP_Query($thumbs); $thumbs = array( ‘meta_query’ => array(‘key’ => ‘_thumbnail_id’) ); should look like this $thumbs = array( ‘meta_query’ => array( array( ‘key’ => … Read more