Envira Gallery Documentation
Documentation, Reference Materials and Tutorials for Envira Gallery
Documentation, Reference Materials and Tutorials for Envira Gallery
Would you like to control the limit of the caption length in your Base lightbox themes? Envira will help you easily create something custom on your site that can help you do exactly that. This guide will show you how to control the text limit on captions for your Base (Dark) or Base (Light) lightbox theme.
To control the amount of text that shows in the top of your lightbox view, just add the following code to a new file at wp-content/plugins/envira-limit-caption-text.php
.
<?php /** * Plugin Name: Envira Gallery - Limit Caption Text * Plugin URI: https://enviragallery.com * Version: 1.0.0 * Author: Envira Gallery Team * Author URI: https://enviragallery.com * Description: Limits caption text for Base LB Themes */ /** * Enable comments on Envira Galleries * * @since 1.0.0 * */ add_filter('envira_gallery_output_lightbox_caption_limit', 'example_envira_gallery_output_lightbox_caption_limit', 10, 5 ); function example_envira_gallery_output_lightbox_caption_limit( $limit, $data, $id, $item, $i ) { return 50; }
return 50;
. This means only that the plugin will limit the caption length to 50 characters. You can easily change that number to whatever you wish before saving the file.Not sure how to do that? Just follow these steps:
envira-limit-caption-text.php
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 – Limit Caption Text plugin.
Here’s what the caption area in the lightbox looked like before the text was limited with the plugin:
And now we can see what the caption looks like after installing the plugin and limiting the length to 50 characters:
And that’s it! You are now controlling the lightbox caption text limits.
If you’d like to extend Envira further, check out some of our other tutorials such as How to Remove WordPress Image Compression.
A: Please check the Lightbox tab to see which Lightbox Theme you are using. This plugin will only limit the caption text for the Lightbox Theme Base (Dark) and Base (Light).
A: Navigate to Plugins » Editor and select the Envira Gallery – Limit caption count on Base Lightbox Themes from the drowpdown and click Select. This will allow you to easily change the return 50;
to what ever you wish. Once you have edited the number, remember to click the Update File button at the bottom of the screen to save the changes.