Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Hooks and Filters for Envira Gallery

Envira Gallery can always be customized to fit your unique use-case. The hooks, filters and custom plugins below will help you tailor your Envira Gallery plugin so that it best meets your site and image needs.

Hooks and filters allow you to edit, remove and add functionality to your Envira Gallery plugin download. That way, you can retain and optimize the most useful features for your site. 

Quick Guide to Envira Gallery Hooks and Filters

Please use these hooks and filters for Envira Gallery to customize your gallery plugin. If you require hooks and filters not on this list, please reach out to our Support Team. Someone is always happy to help!


Hooks and Filters for Envira Gallery

This filter enables Envira Gallery debugging. Add the following to your wp-config.php file:


ini_set ('log_errors', 'On');
ini_set ('display_errors', 1);
ini_set ('display_startup_errors', 1);
error_reporting(E_ALL);

define( 'WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true);
define( 'WP DEBUG DISPLAY', false);

If the Settings menu isn’t available after you’ve activated your Envira Gallery license, apply this filter. Paste the following to your functions.php file:  

function x_envira_gallery_remove_license_functionality() {return true;}

If you are using the Enfold WordPress theme and experiencing issues with hover styles, add the following to your functions.php file:

add_filter('envira_gallery_output_before_image', 'enfold_envira_gallery_output_before_image', 10, 5);
function enfold_envira_gallery_output_before_image($output, $id, $item, $data, $i) {
return $output
}

 


To use the same Envira Gallery license key across multiple WordPress sites, add the following to you wp-config.php file.  Substitute your_license_key with your unique key.

define( 'ENVIRA_LICENSE_KEY', 'your_license_key');

To enable shortcodes inside the gallery descriptions of Envira galleries, add the following to a new file at /wp-content/plugin/envira-gallery-allow-shortcodes.php, then activate the plugin from WordPress dashboard.

/*
* Plugin Name: Envira Gallery - Allow Shortcodes in Envira Gallery Description
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Add shortcodes to your Envira gallery descriptions
*/
add_filter( 'envira_gallery_output', 'do_shortcode');

If images don’t show until user hovers over them on an Enfold theme site, add the following to a new file at wp-content/plugins/envira-enfold-automatic.php, then activate plugin from WordPress dashboard.

/*
* Plugin Name: Envira Gallery - Envira Enfold Conflict
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Resolves conflict with Enfold and Automatic Gallery
*/
add_filter('envira_gallery_output_before_image', 'enfold_envira_gallery_output_before_image', 10, 5);
function enfold_envira_gallery_output_before_image($output, $id, $item, $data, $i) {
$output = str_replace('envira-gallery-link', 'envira-gallery-link noHover', $output);
return $output;
}

To show an unordered or ordered list in Envira gallery captions, add the following to a new file at wp-content/plugins/envira-text-format-for-captions.php, then activate plugin from WordPress dashboard.

/*
* Plugin Name: Envira Gallery - Text Format for Captions
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Allow certain HTML characters in the caption area under gallery images
*/
add_filter('envira_gallery_image_caption_allowed_html_tags','example_envira_gallery_image_caption_allowed_html_tags', 5, 5);
function example_envira_gallery_image_caption_allowed_html_tags($allowed_tags, $id, $item, $data, $i) {
/*allowed tags is an array*/
$allowed_tags['li'] = array();
$allowed_tags['ul'] = array();
$allowed_tags['ol'] = array();
return $allowed_tags;
}

If image filenames are similar, they can confuse the lightbox script. When the filenames are similar and longer than 10 characters, lightbox will show the same image repeatedly. To remedy this issue, add the following to a new file at wp-content/plugins/envira-check-filename.php, then activate plugin from WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Check Filename
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Check the filenames
*/
// First few characters don’t match, likely this is a different image in the same upload directory
// The number can be changed to literally anything.
if ($pos <= apply_filters('envira_gallery_check_image_file_name', 25, $filename_image, $filename_link, $data)) {
return $item;
}

Visit our documentation on how to show a different lightbox image for more information.


To continue using JetPack’s lazy load feature for non-gallery images and Envira Gallery’s lazy load feature for gallery images, add the following to a new file at /wp-content/plugins/envira-jp-lazy-load-filter.php, then activate plugin from WordPress dashboard.

/*
* Plugin Name: Envira Gallery - JetPack Lazy Load Filter
* Plugin URI: https://enviragallery.com
* Version: 1.1.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Allowing JetPack lazy load and Envira lazy load to work in harmony
*/
add_filter('envira_gallery_indexable_image_css', 'jp_envira_gallery_indexable_image_css', 10, 2 );
function jp_envira_gallery_indexable_image_css( $css, $id ) {
$css .= 'skip-lazy';
return $css;
}

add_filter('jetpack_lazy_images_blacklisted_classes', 'envira_jetpack_lazy_images_blacklisted_classes', 999, 1 );
function envira_jetpack_lazy_images_blacklisted_classes( $blacklisted_classes ) {
$blacklisted_classes[] = 'envira-gallery-image';
$blacklisted_classes[] = 'skip-lazy';
return $blacklisted_classes;
}

/* trick Jetpack into thinking there's already a lazy load src for noscript images, so they don't appear */
add_filter('envira_gallery_output_noscript', 'jp_envira_gallery_output_noscript', 999, 2 );
function jp_envira_gallery_output_noscript( $html, $gallery_data ) {
$html = str_replace('<img ', '<img data-lazy-src="">
return $html;
}

For additional help, read our documentation on using Jetpack with Envira Gallery


Create a child theme, then add to child theme’s functions.php file at the bottom before closing the php tag.

if ( current_user_can('contributor') ; !current_user_can('upload_files'))
add_action('admin_init', 'allow_contributor_uploads');
function allow_contributor_uploads() {
$contributor = get_role('contributor');
$contributor -> add_cap('upload_files');
}

For more information, read our documentation on using a WordPress user role.


To resolve conflicts between Ajax Pagination and JetPack’s Lazy Load option, add the following to a new file at wp-content/plugins/envira-ajax-pagination-jetpack.php, then activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Ajax Pagination JetPack
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Remove the filter JetPack uses that breaks the Ajax Pagination with Envira Gallery.
*/
add_filter('jetpack_enable_open_graph', '__return_false');

See our related documentation for more information


To change the background color or opacity of Envira Gallery Lightbox, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to change 414950 to your own unique gallery ID number. 

Change for one gallery
div[data-envirabox-id='414950'] .envirabox-bg{
opacity: 1 !important;
background-color: #7cc048 !important;
}

**Opacity of 1 = 100% (so 0.5 would be 50%)

Change for all galleries

Add the above code the Appearance >> Customize >> Additional CSS.

Read our related documentation for more information.


To customize the lightbox close button, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor.

Change for one gallery
div[data-envirabox-id="431318"] a.envirabox-close {
background-image: url("http://example.com/images/close-button.png") !important;
width: 48px !important;
height: 48px !important;
margin-top: -15px;
right: -35px !important;
}
Use a font-based icon instead of an image
div[data-envirabox-id="431318"] a.envirabox-close {
background-image: none !important;
}
div[data-envirabox-id="431318"] a.envirabox-close:before {
content: "/f158";
font-family: 'dashicons';
}
Include WordPress Dashicons font to your child theme by adding to functions.php
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end');
function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' );
}

Read our related documentation for more information.


To customize the lightbox navigation arrows, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor.

Change for one gallery
div[data-envirabox-id="431673"] .envirabox-next span {
background-image: url("https://example.com/images/envira-arrows.png")!important;
width: 35px !important;
height: 35px !important;
background-repeat: no-repeat;
background-position: 0 0 !important;
background-size: 100%
}
div[data-envirabox-id="431673"] .envirabox-prev span {
background-image: url("https://example.com/images/envira-arrows.png") !important;
width: 35px !important;
height: 35px !important;
background-repeat: no-repeat;
background-position: 0 0 !important;
background-size: 100%
Use a font-based icon
div[data-envirabox-id="431673"] .envirabox-next span {
background-image: none !important;
}
div[data-envirabox-id="431673"] .envirabox-prev span {
background-image: none !important;
}
div[data-envirabox-id="431673"] .envirabox-next span:before {
content: "f519";
font-family: 'dashicons';
}
div[data-envirabox-id="431673"] .envirabox-prev span:before {
content: "f519";
font-family: 'dashicons';
}
Include WordPress Dashicons font in child theme by adding to function.php
add_function( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' );
}

Read our related documentation for more information.


To hide pagination navigation, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 1490 with your own unique gallery ID number.

Change for one gallery
div#envira-gallery-wrap-1490 .envira-pagination {
display: none;
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Read our related documentation for more information.


To remove borders on lightbox, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 415002 with your own unique gallery ID number.

Change for one gallery
div[data-envirabox-id="415002"] .envirabox-image-wrap {
border: none !important;
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Read our related documentation for more information.


To show lightbox navigation on hover, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 431230 with your own unique gallery ID number.

Change for one gallery
div[data-envirabox-id="431230"] .envirabox-inner .envirabox-arrow {
opacity: 0 !important;
}
div[data-envirabox-id="431230"] .envirabox-inner:hover .envirabox-arrow {
opacity: 1 !important;
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Read our related documentation for more information.


To display image titles above gallery images on hover, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 277329 with your own unique gallery ID number.

Change for one gallery
#envira-gallery-wrap-277329 .envira-gallery-item-inner {
background-color: #000 !important;
}
#envira-gallery-wrap-277329 .envira-gallery-item-inner:hover img {
opacity: 0.5 !important
}
#envira-gallery-wrap-277329 .envira-gallery-item-inner .envira-title {
opacity: 0;
position: absolute;
top: 50%;
left: 50%
transform: translate(-50%, -50%);
text-align: center;
color; #fff;
transition: opacity 0.5s ease;
}
#envira-gallery-wrap-277329 .envira-gallery-item-inner:hover .envira-title {
opacity: 1;
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Read our related documentation for more information.


To display image captions above gallery images on hover, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update <code>277329</code> with your own unique gallery ID number.

Change for one gallery
#envira-gallery-wrap-277329 .envira-gallery-item-inner {
background-color: #000 !important;
}
#envira-gallery-wrap-277329 .envira-gallery-item-inner:hover img {
opacity: 0.5 !important
}
#envira-gallery-wrap-277329 .envira-gallery-item-inner .envira-caption {
opacity: 0;
position: absolute;
top: 50%;
left: 50%
transform: translate(-50%, -50%);
text-align: center;
color; #fff;
transition: opacity 0.5s ease;
}
#envira-gallery-wrap-277329 .envira-gallery-item-inner:hover .envira-caption {
opacity: 1;
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Read our related documentation for more information.


To style pagination links in the Pagination Addon, first install and activate the CSS Addon and the Pagination Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 438183 with your own unique gallery ID number.

Change for one gallery
#envira-gallery-wrap-438183 .envira-pagination {
Text-align: center;
}
#envira-gallery-wrap-438183 .envira-pagination a.page-numbers, #envira-gallery-wrap-438183 span.page-numbers.dots, #envira-gallery-wrap-438183 .envira-pagination a.prev.page-numbers, #envira-gallery-wrap-438183 .envira-pagination a.next.page-numbers {
display: inline-block;
padding: 10px
background-color: #363f48;
border-radius: 3px;
text-decoration: none;
transition: all 0.2s ease-in 0s;
color: #fff;
}
#envira-gallery-wrap-438183 .envira-pagination a.page-numbers:hover, #envira-gallery-wrap-438183 .envira-pagination a.prev.page-numbers:hover, #envira-gallery-wrap-438183 .envira-pagination a.next.page-numbers:hover {
background-color: #ccc;
color: #363f48;
}
#envira-gallery-wrap-438183 .envira-pagination span.page-numbers.current {
display: inline-block;
padding: 10px;
background-color: #ccc;
border-radius: 3px;
color: #363f48;
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Read our related documentation for more information.


To style your tags list using the Tags Addon, first install and activate the CSS Addon and the Tags Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 364454 with your own unique gallery ID number.

Change for one gallery
#envira-gallery-wrap-364454 .envira-tags-filter-list li.envira-tags-filter,
#envira-gallery-wrap-364454 .envira-tags-filter-list li.envira-tag-filter {
float: none !important;
display: inline-block !important;
}
#envira-gallery-wrap-364454 .envira-tags-filter-list {
text-align: center !important;
}
#envira-gallery-wrap-364454 a.envira-tags-filter-link {
padding: 5px;
background-color: #7cc048;
border-radius: 3px;
color: #ffffff;
border: 1px solid #7cc048;
text-transform: capitalize;
}
#envira-gallery-wrap-364454 a.envira-tags-filter-link:hover,
#envira-gallery-wrap-364454 a.envira-tags-filter-active {
background-color: #ffffff;
color: #7cc048;
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Read our related documentation for more information.


To style your gallery images on hover, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 336463 with your own unique gallery ID number.

Change for one gallery
#envira-gallery-wrap-336463 .envira-gallery-item img:hover {
box-shadow: 0 10px 15px rgba(0,0,0,0.3);
transition: box-shadow 0.3s ease-in-out;
cursor: pointer;
}
If Envira Lazy Load is enabled on the Configuration Tab of the gallery
#envira-gallery-wrap-336463 .envira-gallery-item .envira-lazy:hover {
box-shadow: 0 10px 15px rgba(0,0,0,0.3);
transition: box-shadow 0.3s ease-in-out;
cursor: pointer;
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Read our related documentation for more information


To black and white filters to your gallery images on hover, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 368044 with your own unique gallery ID number.

Change for one gallery
#envira-gallery-wrap-368044 img {
filter: grayscale(100%);
transition: all 0.3s ease-in-out;
}
#envira-gallery-wrap-368044 img:hover {
filter: grayscale(0);
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Read our related documentation for more information.


To show only 1 column galleries or albums on mobile, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 436789 with your own unique gallery or album ID number.

Change for one gallery
@media only screen and (max-width: 600px) {
#envira-gallery-436798 .envira-gallery-item {
width: 100% !important;
}
}
Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Find more information in our related documentation


To enable zoom on thumbnail images in hover, first install and activate the CSS Addon. Add the following code to the Custom Gallery CSS field under the Misc. tab of the gallery editor. Make sure to update 438745 with your own unique gallery or album ID number.

Change for one gallery
#envira-gallery-438745 .envira-gallery-item img {
transition: all .2s ease-in-out;
}
#envira-gallery-438745 .envira-gallery-item:hover img {
transform: scale(1.1);
}
#envira-gallery-438745 .envira-gallery-item, #envira-gallery-438745 .envira-gallery-item .envira-gallery-item-inner {
overflow: hidden;
}

** Adjust the amount of zoom by editing the transform: scale(1.1) value. A higher number results in a larger zoom.

Change for all galleries

Add the above code to Appearance >> Customize >> Additional CSS.

Find more information in our related documentation.


Add the following to a new file at /wp-content/plugins/envira-change-standalone.php, then activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Change Standalone Template
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Changes the Standalone template.
*/
add_filter( 'envira_standalone_get_custom_template','test_envira_standalone_get_custom_template', 10, 3 );
function test_envira_standalone_get_custom_template( $new_template, $data, $post ) {
$new_template = 'envira-standalone.php';
return $new_template;
}

Find more information in our related documentation.


To speed up or slow down the transition speeds for images in Lightbox, add the following code to a new file at /wp-content/plugins/envira-lightbox-transition-speed.php. Then, activate the plugin from WordPress dashboard.

/*
* Plugin Name: Envira Gallery - Control Lightbox Transition Speed
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Controls the speed of navigating, opening and closing Envira Galleries
*/
add_filter( 'envira_gallery_get_config', 'my_envira_gallery_get_config', 10, 2 );
function my_envira_gallery_get_config( $data_config, $key ) {
if ( $key === 'transition_duration' ) {
$data_config['transition_duration'] = 5000;
}
if ( $key === 'animation_duration' ) {
$data_config['animation_duration'] = 5000;
}
return $data_config;
}

** The above sets the speed to 5000 milliseconds, or 5 seconds.

For more information, read our related documentation.


Add the following to a new file at /wp-content/plugins/envira-gallery-change-breadcrumbs-home-url.php, then activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Change Standalone Template
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Changes the Standalone template.
*/
add_filter( 'envira_breadcrumbs_data', 'test_envira_breadcrumbs_data', 10, 5 );
function test_envira_breadcrumbs_data( $breadcrumbs, $album_id, $gallery_id, $separator, $album_post_id ) {
$breadcrumbs[0]['title'] = 'Envira Gallery Homepage';
$breadcrumbs[0]['url'] = 'http://www.enviragallery.com';
return $breadcrumbs;
}

** Add your own custom title and URL on lines 13 and 14 of the above code.

For more information, read our related documentation.


Change default text from “Images” to “Videos” for video galleries by adding the following code to a new file at /wp-content/plugins/envira-gallery-image-counter-text.php. Then, activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Change Image Counter Text
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Changes 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);
}

For more information, read our related documentation.


Control the amount of time the cookie for the password is set for by adding the following code to a new file at wp-content/plugins/envira-gallery-set-password-cookie.php. This requires the Password Protection Addon.

/**
* Plugin Name: Envira Gallery - Change Password Cookie Time
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Set the cookie time on your password protected galleries
*/
add_filter( 'envira_password_protection_time_limit', 'test_envira_password_protection_time_limit', 10, 3);
function test_envira_password_protection_time_limit( $time_limit, $post, $data ) {
// note: you can use $post and $data to individually set time limit based on post ID, gallery data, etc.
// time is in seconds, so if you wanted to set the time limit for something very short (like 10 seconds)
$time_limit = time() + 10;
return $time_limit;
}

For more information, read our related documentation.


Add the following to a new file at /wp-content/plugins/envira-gallery-whitelabel-url-for-deeplinked-galleries.php, then activate the plugin from your WordPress dashboard. This requires the Deeplinking Addon.

/**
* Plugin Name: Envira Gallery - Custom URLs for Deeplinked Gallery Images
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Create custom URLs for images in deeplinked galleries
*/
add_filter( 'envira_whitelabel', 'test_envira_whitelabel', 10, 1);
function test_envira_whitelabel() {
return true;
}
add_filter( 'envira_whitelabel_envira_deeplinking_slug','test_envira_whitelabel_envira_deeplinking_slug', 10, 1);
function test_envira_whitelabel_envira_deeplinking_slug( $deeplinking_slug ) {
return 'deeplinkme';
}
// note: this code changes the image URL to https://www.enviragallery.com/deeplinkme. You’ll need to add your own code on line 8

For more information, read our related documentation.


Add the following code to a new file at /wp-content/plugins/envira-gallery-customizing-woocommerce.php, then activate the plugin from your WordPress dashboard. This requires the WooCommerce Addon.

/**
* Plugin Name: Envira Gallery - Customizing WooCommerce Envira Galleries
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Change the cart image to an Envira gallery image. Change button and message text when using the Envira Add to Cart button.
*/
add_filter( 'woocommerce_cart_item_thumbnail', 'envira_woocommerce_cart_item_thumbnail', 5, 3);
function envira_woocommerce_cart_item_thumbnail( $image_url, $cart_item, $cart_key ) {
if ( isset( $cart_item[ 'envira_woocommerce_image_id' ])) {
$envira_image_id = $cart_item[ 'envira_woocommerce_image_id' ]'
return '<img src=""'>';
} else {
return $image_url;
}
}
Change the add to cart item name (product name from Woo)
add_filter( 'woocommerce_cart_item_name', 'envira_wc_cart_item_name_hyperlink', 10, 2 );
function envira_wc_cart_item_name_hyperlink( $link_text, $product_data ) {
// Note: You also use envira_woocommerce_image_caption for the below
if ( !isset( $product_data['envira_woocommerce_image_title'] ) ) {
return $link_text;
} else {
$title = sanitize_text_field( $product_data['envira_woocommerce_image_title'] );
}
return sprintf( '', get_permalink( $product_data['product_id'] ), $title );
}
Change the add to cart text
add_filter( 'wc_add_to_cart_message_html', 'envira_custom_add_to_cart_message' );
function envira_custom_add_to_cart_message( $message ) {
global $woocommerce;
// Note: You also use envira_woocommerce_image_caption for the below
if ( isset( $_POST['envira_woocommerce_image_title'] ) ) {
$show_string = sanitize_text_field( $_POST['envira_woocommerce_image_title'] );
} else {
// if this doesn't exist, it's likely an Envira item wasn't added
return $message;
}
$cart_url = get_permalink( wc_get_page_id('cart') );
$message = sprintf('"%s" %s%s', $show_string, __('has been added to your cart', 'woocommerce'), $cart_url, __(' View Cart', 'woocommerce') );
return $message;
}

For more information, read our related documentation.


Add the following to a new file at /wp-content/plugins/envira-keyboard-mousewheel-navigation.php, then activate the plugin from theWordPress dashboard.

/**
* Plugin Name: Envira Gallery - Disable Keyboard and Mousewheel Navigation
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Disable keyboard and mousewheel navigation for galleries and albums
*/
add_filter( 'envira_albums_pre_data', 'my_envira_album_pre_data', 10, 2 );
function my_envira_album_pre_data( $data, $album_id ) {
$data[ 'config' ][ 'keyboard' ] = 0; // 0 for disable, 1 to enable
$data[ 'config' ][ 'mousewheel' ] = 0; // 0 for disable, 1 to enable
return $data;
}

For more information, read our related documentation.


Turn off the Pinterest Pin It Button for gallery images by adding the following to a new file at /wp-content/plugins/envira-gallery-disable-pinterest-button.php. Then, activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Disable Pinterest Button on Image Hover
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Adds nopin=”nopin” to Envira gallery images, disabling the Pinterest Button on hover
*
* @param string $atts <img> tag attributes
* @param int $id Image ID
* @param array $item Image Data
* @param array $data Gallery Config
* @param int $i Index
* @return string Image Attributes
*/
function envira_disable_pinterest_button( $atts, $id, $item, $data, $i ) {
return $atts . 'nopin="nopin"';
}
add_filter( 'envira_gallery_output_image_attr', 'envira_disable_pinterest_button', 10, 5 );
add_filter( 'envira_albums_output_image_attr', 'envira_disable_pinterest_button', 10, 5 );

For more information, read our related documentation.


Add the following to Appearance >> Customize >> Additional CSS, or to your theme’s style.css.

select.envira-tags-dropdown{
-webkit-appearance: menulist;
border: 1px solid #bbb;
-webkit-border-radius: 3px;
border-radius: 3px;
max-width: 100%;
margin: 10px 0;
}

For more information, read our related documentation.


Enable archives for standalone links to create a list of all galleries or albums as a link to the gallery or album standalone link by adding the following to a new file at /wp-content/plugins/envira-standalone-archive-support.php. Then, activate the plugin from your WordPress dashboard.

For galleries 
/**
* Plugin Name: Envira Gallery - Standalone Feature - Enable Archives
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables archives for Envira Custom Post Type
* Enable archives and featured image capabilities on Envira galleries
*/
function envira_standalone_enable_archives( $post_args ) {
$post_args['has_archive'] = true;
$post_args['supports'] = array( 'title', 'thumbnail' );
return $post_args;
}
add_filter( 'envira_gallery_post_type_args', 'envira_standalone_enable_archives');
For Albums
/**
* Plugin Name: Envira Gallery - Standalone Feature - Enable Archives and Featured Image
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables archives for Envira Custom Post Types
*/
/**
* Enable archives and featured image capabilities on Envira galleries
*/
function envira_standalone_enable_archives( $post_args ) {
$post_args['has_archive'] = true;
$post_args['supports'] = array( 'title', 'thumbnail' );
return $post_args;
}
add_filter( 'envira_albums_post_type_args', 'envira_standalone_enable_archives');
Enable for both Albums and Galleries
/**
* Plugin Name: Envira Gallery - Standalone Feature - Enable Archives and Featured Image
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables archives for Envira Custom Post Type
*/
/**
* Enable archives and featured image capabilities on Envira Galleries
*/
function envira_standalone_enable_archives( $post_args ) {
$post_args['has_archive'] = true;
$post_args['supports'] = array( 'title', 'thumbnail' );
return $post_args;
}
add_filter('envira_albums_post_type_args', 'envira_standalone_enable_archives');
add_filter('envira_gallery_post_type_args', 'envira_standalone_enable_archives');

For more information, read our related documentation.


Enable comments for standalone links by adding the following to a new file at /wp-content/plugins/envira-standalone-comments.php. Then, activate the plugin from your WordPress dashboard.

Comments for Galleries
/**
* Plugin Name: Envira Gallery - Enable Comments
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables comments for Envira CPT
*/
function envira_standalone_enable_comments( $post_args ) {
$post_args['supports'][] = 'comments';
return $post_args;
}
add_filter( 'envira_gallery_post_type_args', 'envira_standalone_enable_comments' );
function envira_standalone_comments_metabox( $ids ) {
ids[] = 'commentstatusdiv';
return $ids;
}
add_filter( 'envira_gallery_metabox_ids', 'envira_standalone_comments-metabox' );
Comments for Albums
/**
* Plugin Name: Envira Gallery - Enable Comments
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables comments for Envira galleries and albums
*/
function envira_standalone_enable_comments( $post_args ) {
$post_args['supports'][] = 'comments';
return $post_args;
}
add_filter( 'envira_gallery_post_type_args', 'envira_standalone_enable_comments' );
add_filter( 'envira_albums_post_type_args', 'envira_standalone_enable_comments' );
function envira_standalone_comments_metabox( $ids ) {
$ids[] = 'commentstatusdiv';
return $ids;
}
add_filter( 'envira_gallery_metabox_ids', 'envira_standalone_comments_metabox' );
add_filter( 'envira_albums_metabox_ids', 'envira_standalone_comments_metabox' );

For more information, read our related documentation.


Turn on Distraction Free viewing for lightbox images in all galleries by adding the following to a new file at /wp-content/plugins/envira-disable-distraction-free.php. Then, activate plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Disable Distraction Free Mode
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Disables Distraction Free Mode on Envira Lightbox
*/
add_filter( 'envira_gallery_get_config', 'my_envira_gallery_get_config', 10, 2 );
function my_envira_gallery_get_config( $data_config, $key ) {
if ( $key === 'idle_time' ) {
$data_config['idle_time'] = 60; // false would completely turn off the option and is set to false by default. Change this to 60 to have the idle time kick in after 60 seconds
}
return $data_config;
}

For more information, read our related documentation.


Add the following to a new file at /wp-content/plugins/envira-remove-fragment-cache.php, then activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Remove Fragment Cache
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Removes fragment cache
*/
add_filter( 'envira_gallery_get_transient_markup', '__return_false');
add_filter( 'envira_gallery_should_cache', '__return_false');

For more information, read our related documentation.


Remove dots that appear between page numbers by adding the following to a new file at /wp-content/plugins/envira-remove-pagination-truncation.php. Then, activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Remove Pagination Truncation
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Removes the dots from the pagination and replaces them with a complete number count
*/
add_filter( 'envira_pagination_link_args', 'test_envira_pagination_link_args', 10, 3);
function test_envira_pagination_link_args( $pagination_args, $html, $data ) {
$pagination_args[ 'show_all' ] = true;
return $pagination_args;
}

For more information, read our related documentation.


Remove default image compression that WordPress applies to uploaded images by adding the following to a new file at /wp-content/plugins/envira-remove-wordpress-image-compression.php. Then, activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Remove WordPress Image Compression
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Removes the compression WordPress applies to images upon upload
*/
/**
*Override the default image quality when resizing and cropping images
*/
add_filter( 'jpeg_quality', function($arg){return 100;});

For more information, read our related documentation.


Override WooCoommerce redirect settings when viewing an Envira gallery by adding the following to a new file at /wp-content/plugins/envira-gallery-stay-on-woo-gallery-page.php. Then, activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Stay on Gallery Page
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Overrides the setting to direct to cart and stay on gallery page
*/
add_filter( 'envira_gallery_pre_data', 'woocommerce_example_envira_gallery_pre_data', 10, 2 );
function woocommerce_example_envira_gallery_pre_data( $data, $gallery_id ) {
$data['config']['woocommerce_add_to_cart_redirect'] = 'self';
return $data;
}

For more information, read our related documentation.


Change all instances of “Envira Gallery” to “Gallery” and remove Envira banner and branding by adding the following to a new file at /wp-content/plugins/envira-whitelabel.php. Then, activate the plugin from your WordPress dashboard.

/**
* Plugin Name: Envira Gallery - Whitelabel Envira
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Text Domain: envira-whitelabel
* Description: Removes Envira Gallery branding
*/
add_filter( 'envira_whitelabel', '__return_true' );
if ( apply_filters('envira_whitelabel', false ) ):
add_filter( 'envira_whitelabel_name', 'example_envira_whitelabel_name' );
add_filter( 'envira_whitelabel_name_singular', 'example_envira_whitelabel_name' );
add_filter( 'envira_whitelabel_name_plural', 'example_envira_whitelabel_name_plural' );
function example_envira_whitelabel_name() {
return 'Gallery';
}
function example_envira_whitelabel_name_plural() {
return 'Galleries';
}
// actions (Envira):
// envira_whitelabel_header_logo
// envira_whitelabel_default_display
// envira_whitelabel_tab_text_images
// envira_whitelabel_tab_text_config
// envira_whitelabel_tab_text_lightbox
// envira_whitelabel_tab_text_mobile
// envira_whitelabel_tab_text_misc
// filters (Albums):
add_filter( 'envira_album_whitelabel_name', 'example_envira_album_whitelabel_name' );
add_filter( 'envira_album_whitelabel_name_singular', 'example_envira_album_whitelabel_name' );
add_filter( 'envira_album_whitelabel_name_plural','example_envira_album_whitelabel_name_plural');
function example_envira_album_whitelabel_name() {
return 'Album';
}
function example_envira_album_whitelabel_name_plural() {
return 'Albums';
}
// actions (Albums):
// envira_album_whitelabel_text_available_galleries
// envira_album_whitelabel_text_settings
// envira_album_whitelabel_lightbox_settings
// actions (Standalone):
// envira_standalone_whitelabel_tab_helptext
// actions (Addons):
// envira_instagram_whitelabel_tab_helptext
// envira_watermarking_whitelabel_tab_helptext
// envira_tags_whitelabel_tab_helptext
// envira_social_whitelabel_tab_helptext
// envira_social_lightbox_whitelabel_tab_helptext
// Example:
function example_envira_instagram_whitelabel_tab_helptext() {
echo 'custom text here';
}
add_action( 'envira_instagram_whitelabel_tab_helptext','example_envira_instagram_whitelabel_tab_helptext');
// filters (Misc):
// this filter controls if you want the addon menu displayed in WordPress backend (default false)
add_filter( 'envira_whitelabel_addon_screen', 'example_envira_whitelabel_addon_screen' );
function example_envira_whitelabel_addon_screen() {
return true; // make this true if you want to show the addon screen when whitelabel is active
}
endif;
Change the URL on the tag filter
add_filter( 'envira_whitelabel_envira_tag_slug', 'test_envira_whitelabel_envira_tag_slug', 10, 1);
function test_envira_whitelabel_envira_tag_slug( $tag_slug ) {
return 'gallery-tag';
}
Disable Welcome Screen on Envira

define( 'ENVIRA_WELCOME_SCREEN', false ); 

For more information, read our related documentation.

Remember, if you require hooks and filters not on this list, please reach out to our Support Team. We’re always developing new hooks and filters, as well as custom plugin solutions, for Envira Gallery. If you don’t see the right hooks and filters you need here, our Support and Development teams can help you customize your plugin.

Our Support Team is also happy to help walk you through how to use these Envira Gallery hooks and filters should you need assistance.