I am a beginner coder so please give answers as simply as you can. I installed Envira Gallery on Wordpress to showcase my digital art. I want to add long captions to my art, maybe 1000 characters. This is because I'll be entering long HTML 'IMG' and 'A' tags in there, as icons and links to stores that sell each artwork.
The preset character limit for captions in Envira is 100 characters - after that it gets truncated. This page gives a plugin to change that limit.
<?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;
}
But the code does not work. return 50; is not accepted in Wordpress. It gives this error:
Parse error: syntax error, unexpected '50' (T_LNUMBER) in your code on line 6
I am not a PHP editor so I don't know what this means or how to fix it. So I hope someone can give me instructions on how to edit this code to allow the caption limit to be like 1000 characters.
So far I've just tried to install that PHP code, and replaced the 50 with a 1000.
Well it turns out there were invisible characters in my code messing it up. Once I got rid of those the code worked. Hope this helps someone else.