Depending on whether the captions are using the same CSS class or HTML tag, you can add a :before pseudo element to the CSS. This will add an image before every <caption> tag on your website.
caption:before {
content: '';
display: inline-block;
background: url('your-image-url-here');
background-repeat: no-repeat;
background-size: contain;
background-position: center center;
height: 15px;
width: 15px;
}
Alternatively, if you wanted to use the WordPress glyph icons, try the following:
caption:before {
content: '\f129';
font-family: dashicons;
}
And don’t forget to enqueue the dashicons in your functions.php file:
function enable_frontend_dashicons() {
wp_enqueue_style( 'dashicons' );
}
add_action( 'wp_enqueue_scripts', 'enable_frontend_dashicons' );
Related Posts:
- Get Image Description
- How to have different captions for same image, for galleries?
- Featured image shortcode
- How to wrap WordPress image captions inside H2, H3 tags?
- getting uploaded SVG dimensions on front-end
- Theme Customiser Image Control
- Is there a way to define a default caption to all uploaded images
- How to add a link in a image’s caption?
- Get img alt tag from a Image that has been uploaded through the Customizer
- Alter media caption/description conflict in WordPress?
- How to display a shortcode caption somewhere other than the_content
- Caption in Page adding unwanted 10px to width
- Adjust image caption within visal editor
- Drag images with caption in WP editor
- Different captions for the same image in multiple galleries. Edit Image in Gallery locally
- SSL: How to make customizer images Protocol Relative in WordPress?
- Include captions
- Featured Image .svg height and width 1px only
- HTML tags in WordPress image caption
- Add attribute to caption shortcode from custom attachment field
- SVG Featured image not shown in twitter
- Removing height and width from images with a caption
- Include caption underneath post images
- Turn off image captions in gallery view?
- Move Image Captions Inside Link ( tag) if Added
- How to add custom classes to figure element only if image has caption?
- Replace image caption with its title and description
- Problem Cropping Images From WP Customizer
- wp_customize_image_control deprecated add_tab alternative
- Omit image captions from get_the_content()
- How to upload and style svg logo?
- Allow SVG in WP step by step
- Random home page background images with caption text
- How to edit caption for images and exclude it from excerption query?
- Place image caption outside of figure tag (Gutenburg Image Markup)
- How to join Caption AND Description Meta Fields as one combined-caption in Image Block
- Hover a css icon width other color inside wp_get_attachment_image
- how automatically show the image title before the image caption/description in a wordpress gallery?
- How to Display Image Caption but Not Alt Text
- How to auto add image caption from image alt?
- Is there a way to create referable automatic numbering in image captions?
- Displaying “alt” attribute text as captions?
- page displaying media caption shortcodes
- How to add a credit line to a photo caption
- Utilise WP_Customize_Image_Control to only show image picker
- 3.5.x Theme Customize: Handling Custom Control Requests
- Wrap a post image with a div if it doesn’t have a caption
- change with CSS the color of an svg background image set with “background-image: url()”
- Set image dimension for WP_Customize_Image_Control images
- Why are some SVG-images not visible in my footer?
- How to return responsive images from a sanitize_callback?
- Can’t upload svg files in WordPress
- CSS how to target the caption of one individual image?
- How do I link an image in a svg file in wordpress?
- Where is the right place to store custom images?
- Load Gallery Images with Title on Homepage BX Slider
- Resize images in batch
- how to get image full path from WP_Post Object?
- Advice on image heavy site, compression and slow page loads
- Not seeing text alignment option in Image block
- wp_get_attachment_url images in wrong order [closed]
- Blurry images when using add_image_size with crop
- Auto delete pictures in media library by age
- Migrated site – Images have 404 error
- Shortcode function doesnt work without caption
- Show (print) featured image all dimensions (height, width)
- How to get image URL from media_sideload_image?
- Can’t get text to wrap around image
- Serve different images per screen size and cache possible?
- Convert featured images into “product images”
- How to use the thumbnail size with catch_that_image
- Not able to retrieve image id from sibling site within a switch_to_blog
- How to display a warning when an uploaded image is too small?
- Having an issue in compressing Images in wordpress site
- How to generate alt attributes with php / filters?
- Word press cutting sliding images – not displaying the entire image
- Image links broken / “DNS Update Required” message
- Convert multiple image blocks to gallery block in Gutenberg?
- WordPress After migration some images src is empty
- Image sizes reset when changing theme
- How to get featured image of last post in a category?
- How can I add “alt” tag to element?
- Recovered WordPress installation (on localhost) links broken and images not showing
- Custom Background for each page and post
- How can the alt be added to this wooCommerce category image?
- Customizer Image-Picker Preview Not Working
- Media sizes do not appear
- How to make Facebook share the featuterd image from url on WordPress
- Delete images of a particular size
- How to watermark wordpress images from wp-content/uploads folder with htaccess and php?
- Images not rendering
- Retrieving Image Storage path
- Add category description to list of category with taxonomy image
- How do I get the URL of only the first picture in a WordPress post?
- Specify what to do for a specific image number of the post
- Images getting corrupt automatically
- Thumbnail size keeps resetting automatically
- How to import external media items into wordpress media library (without using storage)
- WordPress Site Broken and it gives Headers Already sent error
- wp_get_attachment_image with custom size not rendering possible 2x srcset image