Getting specific image thumbnail urls of attached images

Have a look at wp_get_attachment_image_src <?php $attachment_id = 8; // attachment ID $image_attributes = wp_get_attachment_image_src( $attachment_id, ‘medium’ ); // returns an array if( $image_attributes ) { ?> <img src=”https://wordpress.stackexchange.com/questions/169475/<?php echo $image_attributes[0]; ?>” width=”<?php echo $image_attributes[1]; ?>” height=”<?php echo $image_attributes[2]; ?>”> <?php } ?> Source: http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src#Default_Usage

No srcset for hard-cropped thumbnails

To show a srcset, there must be multiple image sizes of the same aspect ratio. When you set your thumbnail to hard crop without creating any other image sizes you are ensuring that there won’t be a srcset. You might find my answer here helpful. Briefly, in your case, adding this line: add_image_size ( ‘double-size’, … Read more

Store thumbnails and uploads in different directories?

It appears that the thumbnail URLs are generated relatively to the upload folder. So trying to store them outside the uploads folder is not going to be a good idea. There are hacks to filter the output for functions such as the_post_thumbnail_url(), but considering side issues such as the thumbnails not being able to be … Read more

Adding a photo to each WP user

I use a plugin called Avatar Manager for that function. The author has also done a tutorial on how to write your own avatar manager plugin, but unfortunately it is also a bit outdated and doesn’t work anymore. Although the plugin states it is compatible up to 3.6.1, it is still working in 3.8.1. I … Read more

Add Thumbnail to wp_list_categories()

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

Completly disable and remove Thumbnails?

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

WordPress remove EXIF Data from specific Thumb

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