By default images already have unique class’s but this depends on your theme. Use firebug and hover over the images and you should see stuff like class="aligncenter size-full wp-image-1525"
.
If you want to change the class or id or alter any attributes of the image you can use the get_image_tag
filter. For example,
add_filter('get_image_tag_class','my_custom_class');
function my_custom_class($class){
$class="my_custom_name";
return $class;
}
Related Posts:
- Replace image attributes for lazyload plugin (data-src)
- Unattaching images from a post
- how to replace embedded “full” sized images within a post with the “large” ones
- wp-cli post create & media import issues
- Best Way to Add UnEditable HTML to Posts
- How to allow multiple thumbnail upload for Posts?
- Modified core/image rendering not showing in posts – only on pages
- Customizing individual images on posts
- How to display data in archive page?
- Delete post by giving its link
- How to add pagination in between post and comments?
- How to display featured image without it appearing in post?
- How to include a post type in the admin/backend?
- Can I use images as anchor tags with
- Set terms in a custom post
- Get posts of ONE taxonomy term of custom post type
- WordPress Custom Fields (Checkboxes with multiple values)
- Ajax Dynamic Archives not showing correct results
- Featured Image uploaded, attached and set but only appearing in the media library
- Load post attached images on a single page site with fancybox
- creating front end image uploader that uploads images as posts
- Errors when uploading images in WP 3.5
- I want to display custom text widgets for each post in the sidebar?
- How to make number of blog posts a custom field?
- Display posts styled exactly like default posts
- WordPress blog or WordPress website
- How to make classes for posts?
- Using custom post template
- Format the Layout of Images In The Edit Post Textarea?
- Custom Post Archive Page not working
- Hiding Draft Post In Admin
- Print all the tags from a custom post type Please
- Display multiple custom taxonomy values on single custom post types page?
- Adding custom fields to bbpress reply form
- Set size for attachments
- Move first half of posts to one parent page, second half to the other page
- Adding buttons to Add New Post and Add New Page
- Custom Post Type – Category Rewrite – Remove Rewrite from Sitemap
- CPT archive redirects to single post
- Show posts by a custom post author
- I have a site where attachments in the wp_posts table have guid values of guid, how did this happen?
- CSS: How can I show a photo beyond the template’s column, but contained within the browser window? [closed]
- Get all attachment by post excluding featured and content inside
- Ajaxify This Code
- Custom loop pagination links not working
- Prevent Delete Attachment by URL or When Submit
- Enable Comments Box On Custom Post Type
- How can i limit the number of posts created per category?
- Search results posts_orderby and ID
- Pausing and Resuming WP_Query results
- Getting Custom Post Loop to display in Bootstrap 3 column grid
- Turn On Comments On Custom Post Types in Directory Theme
- WordPress custom Query for Posts in Category display posts multiple times
- Responsive images with custom image size
- Making a custom Pagination for multi page blog post
- ERROR: Your feed is invalid (after update WP4.7) in custom types
- Editing the default page to show all posts, rather than most recent ones
- Unable to restore from backup – how to obtain old blog posts?
- Get attachments for posts that belongs to a specific category
- List all categories with featured image from post?
- Automatically add date to the auto generation of post slug
- Is Hfeed class for all pages needed
- Permission issue with custom post type – not added to menu – by plugin
- Duplicate Custom Post Type and Taxonomy Slug
- How could I change my Permalink from blog to custom structure? [closed]
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- Take a received feedback item, turn it into a post
- Getting value from get_post_custom
- WP Admin register taxonomy and post type performance
- Add a custom meta box in the post options that loads some html code in the header
- Static posts page with home.php
- Calling Different Custom Post Timestamps in a table
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Admin – create custom post status and display above table
- Get all images in post and comments like Twitter before post title
- custom post template file not shown, instead all the time 404.php
- Set Default Category to Username
- How to allow visitors to filter posts by multiple taxonomies
- Show only posts with images and a fixed amount of posts
- Issue where WP Featured Image will not display
- show custom post type category dropdown sorting result on same page
- Custom Post Type Rewrite To Include Parent Page(s)
- How would one change the default url structure of attachments?
- Thumbnail & Category link aside post
- Anyone know why wordpress converts some html entities to their numeric equivalents?
- Redirect to another page using contact form 7? [closed]
- If statement to check if post has image
- How to include my own css in post
- Gather posts into a cart/lightbox and share with another user
- Custom post types related to same custom post type?
- How do I insert a post with custom post type and relate it to a custom taxonomy?
- Dynamically switch template on click
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- Thumbnail Image to go in the post aswell
- Remove Featured Image & All Media Uploaded to the Post
- Is it possible to customize the post according to post format in single.php?
- Customize rel=canonical tag for single blog post
- a little direction on custom post type
- disable Tab post on nav-menus page (Admin)
- What are the benefits of setting a “featured image” for a WP blog post?