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 to upload multiple images to use as gallery in Kirki Framework
- How do I link an image in a svg file in wordpress?
- show hide image script after 4 seconds [closed]
- Restricting users to view only media library items they have uploaded?
- How do I disable responsive images in WP 4.4?
- Filter to remove image dimension attributes?
- How to get a list of all the possible thumbnail sizes set within a theme
- How do I get the avatar URL instead of an HTML IMG tag when using get_avatar?
- Image Upload from URL
- Programmatically adding images to media library
- How do I delete all UNUSED images from my uploads directory?
- Set default image sizes in WordPress to hard crop
- Is it possible set a featured image with external image URL
- get attachment title based on attachment id
- Stop wordpress from hardcoding img width and height attributes
- Handle issues with change of image scaling (rounding) in 4.1 (WP Ticket #18532)
- Programmatically get images by URL and save in uploads folder
- Prevent WordPress from generating medium_large 768px size of image uploads?
- remove or update add_image_size
- How to extend the gallery block in Gutenberg?
- Image quality based on image size
- Function to get URL of original uploaded image – full size
- how to get original image using wp_get_attachment_image_src
- What is a good alternative to using $content_width for image optimization?
- get the attachement url for the medium sized image
- Can I attach image to post without adding it to post?
- Automatically replace original uploaded image with large image size
- WordPress crop tool greyed out
- How to scale up featured post thumbnail?
- Upload images to remote server
- Custom image size / thumbnail – Crop to aspect ratio even when source image is smaller than set dimensions
- Each custom image size in custom upload directory?
- Getting Images from theme’s directory in pages
- Set default image link target in Gutenberg image block
- Add an alignment option for images
- How to delete resized (cropped) image uploads and prevent future resizing?
- How to automatically add rounded corners to thumbnails?
- WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)
- Download an image from a webpage to the default uploads folder
- Add image size where largest possible proportional size is generated
- WP 4.4. responsive images browser choosing the “wrong” one
- After Moving a Site to Another Domain, All Images Are Lost
- Prevent WordPress from adding image’ title automatically
- Overide Gallery Default Link to Settings
- Retrieve featured image
- How to change image type for specific size?
- Add new image size to media uploader so users can insert into post?