Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to change the Image Counter Image text inside of the Envira Gallery Image Counter

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.

This tutorial is a bit more technical than our other docs, but we’ll walk you through the process step by step. In order to change the text, we’ll need to create and upload a basic WordPress plugin.


Creating the Plugin

To change the default Image text to Video, just add the following code to a new file at wp-content/plugins/envira-gallery-image-counter-text.php.

<?php 
/**
* Plugin Name: Envira Gallery - Change Image Counter Text
* Plugin URI: https://enviragallery.com
* Version: 1.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: This will allow you to change the default 'Image' text for the Envira Gallery Image Counter
*/
add_filter( 'envirabox_theme_image_counter', 'test_envirabox_theme_image_counter', 10, 3 );
function test_envirabox_theme_image_counter( $html, $theme, $data ) {
    return str_replace('Image', 'Video', $html);
}

If you’re unsure how to create a plugin file, follow these steps below:

  1. Open a text file and make sure that it is a plain text document. You can use a plain text editor like Notepad or a code editor of your choice.
  2. Next, copy and paste the code shown above into the file and save the file as envira-gallery-image-counter-text.php.
  3. Once you’ve saved the file you can easily upload this directly to your /plugins directory on your server using FTP or you can right-click on the text document and zip (or compress).
  4. Finally, log in to your WordPress dashboard and go to Plugins » Add New » Upload Plugin and upload the .zip file you just created in the previous step.

Activate the Plugin

Your next step is to activate the plugin you just uploaded. Simply navigate to the Plugins from within your WordPress dashboard and activate the Envira Gallery – Change Image Counter Text plugin.

Activate the plugin to change the Envira Gallery Image Counter text

After activating, you will see the text change inside of the image counter on all galleries that have the image counter enabled.

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.

 

[i]
[i]