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?
- Default Image Link Removal
- How to copy and paste a picture found on the web to wordpress easily
- Graphing libraries for WordPress [closed]
- add_image_sizes ignoring crop sizes and using proportion
- get_intermediate_image_sizes Get the Size Names but How Do I Get the Sizes?
- custom image size with New Media Manager in wordpress 3.5
- Uploading images: ‘ø’ get replaced with ‘ø’
- How to add qtranslate multi language support for media?
- custom image dimensions (for gallery)
- Screenshot.png not showing up
- Images will not display, when I call them up with html in wordpress, just two blank small spaces [closed]
- Force minimum image size and aspect ratio when uploading images
- Change align classes for images
- Fixing image names for a site being restored
- Upload Image using wp_insert_attachment and file url don’t have file extension
- Custom header tiling?
- Display an icon with get_post_meta?
- Include WooCommerce 2’s prettyphoto scripts on all site pages
- Random background image showing on website per click/load
- How to force WordPress to upscale images?
- How to stop WordPress from completely overriding my tags in my templates?
- Image text wrap not working properly on frontend
- How can i add a section of category image upload during adding of category in wp admin area?
- remove enclosure url from feed
- Show last 12 uploaded images on home page, but only from posts
- Link to full-size image for subscriber only
- Thumbnail and image management
- Change Image Size option in the settings in bulk
- Rebuilding core image block
- Custom image size with srcset
- How to get title of images in post content
- Use wget to find used images
- How to source control manage site images
- Server peek by Own-IP-Calls?
- Change Featured Image Size of the Post
- Surround uploaded image link with div
- Check if post has image
- How do I mitigate the forward slash problem for URLs of images after a WP migration?
- WordPress file browser
- how do i update version for super skeleton
- Load Webp Version of Image if it exists
- Convert User’s Avatar/Gravatar to a jpg or png on the Fly
- Placing a background image with text over it
- Is there a way to add background-image to theme.json?
- After importing using wordpress importer, posts in duotone theme do not pick up background colours from image
- I can’t insert more than one image when creating a custom email
- How do I set attributes for all images in a site