Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to change the Image Counter text

Do you have a video gallery with the Envira Gallery Image Counter enabled? Would you like to be able to change the Image text to Video instead? This tutorial will walk you through how to change this default text from ‘Images’ to ‘Videos’ for your video galleries.

Heads up!

This article contains PHP, CSS, and/or JavaScript to customize our plugin. We offer this code as a courtesy but don’t provide support for additional code customizations or 3rd party development.

Adding the code snippet

To change the image counter text in Envira Gallery, you can apply a custom filter to modify the default text. Implementing this requires adding a custom PHP snippet to your WordPress site. Follow the instructions in this document to learn how to safely add PHP snippets to your site.
Here’s the code snippet you’ll use:
/* Change the Image Counter text 
 * 
 * @link https://enviragallery.com/docs/how-to-change-the-image-counter-text/
 */
add_filter( \'envirabox_theme_image_counter\', \'test_envirabox_theme_image_counter\', 10, 3 );

function test_envirabox_theme_image_counter( $html, $theme, $data ) {
//Replace Video with your own label for the counter
    return str_replace(\'Image\', \'Video\', $html);
}

Customizing the snippet

After implementing the snippet, the image counter in your gallery will display your custom label. All you need to do is replace “Image” with your choice of words in the snippet and the counter will display using your customization.
By customizing the image counter text in Envira Gallery, you can enhance the relevance and context of your gallery content, ensuring that it aligns with the type of media you’re showcasing.

That’s it! Would you like to extend Envira further? Check out our tutorial on how to Remove Fragment Cache from Envira Gallery.


FAQs

Q: Can I apply different text for different galleries?

A: At this time, the text entered in this plugin will be applied to all galleries that have the Image Counter enabled.