The class
attribute contains the size in the format attachment-$size
, you could do a check for a specific size like:
if( strstr( $attr['class'], 'thumb' ) ):
// size is attachment-thumb
endif;
Related Posts:
- can’t output gray scaled image I’ve created using add_image_size
- Filter to remove image dimension attributes?
- Removing Image and Caption Dimension Attributes
- Changing JPEG compression depending on image size
- Change WordPress image URLs via filter
- Remove title attribute from images
- Disable resizing of gif when uploaded
- Add ‘if exists’ to filter
- Disable wordpress image sizes generation
- How to removes all instances of thumbnails displayed in my theme?
- wp_upload_bits Upload Specific Sizes Only
- Redirect to another page using contact form 7? [closed]
- Override has_post_thumbnail function
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- How to disable thumbnail filter for a specific template part or image size?
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Removing URL and adding container around image in the featured image metabox
- How to apply filter on get_the_post_thumbnail()
- How to change Gallery image url in product page ? In function.php?
- Distinguish between page and post in function
- WordPress set featured image to first image of the post
- Set post featured image to author image
- Print url to default featured image
- How to filter wp_get_recent_posts() to only posts that have thumbnails?
- List all image sizes still getting disabled sizes
- changing size image within the content
- How to replace all images in all posts and pages with a different size?
- Wrapping Featured Image on Add/Edit Page in div?
- I tried to move the featured image below the paragraphs but now it is displaying twice
- the_post_thumbnail responsive srcset not populating with custom image size
- How to add headers to outgoing email?
- How to change image type for specific size?
- How to add multiple image sizes of the same size with add_image_size
- LESS CSS enqueue_style with add_filter to change rel attribute
- Remove description from on Home
- add_filter to youtube embeds?
- How can I detect if a user changes their password?
- Moving sharedaddy buttons (in Jetpack) to the top of a post?
- Add class to woocommerce checkout body based on filter [closed]
- changing variable through filters or action hooks
- filter the_title problem in nav
- add_image_size and add_filter(‘image_size_names_choose’, ‘my_custom_image_sizes’) not working with wordpress 3.5.2
- Changing Gutenberg / WP block editor width only on pages, not posts or other taxonomies
- How to replace any occurence of Gravatars with a local placeholder image?
- Ignore dots when searching in the media library?
- How To Get User Data in Callback Function for pre_user_nicename?
- What’s the best way to split admin-only functionality in the theme’s functions.php file?
- WordPress Uploader Editor shows broken image
- Thumbnails produce unwanted gray pixels on white background [closed]
- Where is this inline CSS code [closed]
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- WordPress reduces the full size image and uses it as the original
- Which built-in WordPress files are safe to edit?
- Why won’t my preg_replace work with content_save_pre?
- How Does comment_author Filter Work?
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- Add ‘data-text’ attribute to TagCloud HTML
- Walker_Nav_Menu doesn’t work in wp_page_menu_args filter
- get_posts() and filters
- upload_files cap to not loggen in users – add_cap to not logged in users
- Cannot change the definition of AUTOMATIC_UPDATER_DISABLED
- How do I add a checkmark to my-sites save settings hook
- Add Lightbox To WordPress Native Gallery
- How do I override the_excerpt so that it will display full content?
- get_post() containing gallery is outputting an unmatched closing div at the end of the content
- Post thumbnail throwing size limit parameters in
- Trouble using remove_filter to override function in parent theme
- How do I hook my function to run only after submitting login form
- Prepending character(s) to a custom tag title?
- Modify existing plugin function with add_filter
- include specific Pages to wp_list_pages with filter
- Email Obfuscation: Is antispambot() Acceptable? [closed]
- WordPress not creating “large” thumbnails
- What are the steps + prerequisites for using an add_filter?
- an action hook when a post reaches a certain number of views
- WordPress overwrites UNC
- Excluding posts by meta, and also keeping posts without the meta
- How do I display the featured image from an image gallery using a reference in code? (example within)
- attach several images to post + gallery
- Change tags url to search different site
- How to optionally append components to the output of a gutenberg block?
- How to add custom media library mime icons?
- Custom SQL query slows down when using multiple OR … LIKE … in posts_where filter
- get_post() with filters applied
- Drop down filter sort posts by latest, last 7 days and monthly
- Function not returning correct value for found_posts filter
- WordPress create thumbnails on demand
- Unable to defer loading of jquery
- Override admin selected page layout
- How to trigger “wp_handle_upload_prefilter” filter when uploading an image programatically?
- Login logout below menu bar
- Add HTML to the bottom of each post in a post list
- Use a different catalog image than the featured image
- URL to filter posts by post meta similar to shop/?product_cat=”painting”
- Declare global variable that can be used on other function
- What scope is $blog_url = get_bloginfo() inside a function
- How we make the filter for fornt end user
- How to modify Media Library images DPI [ image quality down to make small in size ] [closed]
- Query Multiple Filters, one with Meta
- How to remove a filter that is an object method?