Remove image number
-
Hey, excellent plug-in and super-easy. Referring to a previous question about removing “Image” from the captions (https://wordpress.org/support/topic/image-in-front-of-title-and-number-on-fancybox-overlay/) I would like to remove the image numbers too, eg 1/13. Is there some custom CSS for this?
The page I need help with: [log in to see the link]
-
Actually you cannot do it with CSS.
A quick fix would be to edit the file lightbox.php, lines 144-148 from this:
$gall .= ' , "titleFormat" : function(title, currentArray, currentIndex, currentOpts) { return "<span id=\'fancybox-title-over\'><span id=\'fancybox-title-pretext\'>'.__('Image','simplest-gallery').' </span>"+(currentIndex+1)+" / " + currentArray.length + (title.length ? " " + title : "") + "</span>"; }';to this:
$gall .= ' , "titleFormat" : function(title, currentArray, currentIndex, currentOpts) { return "<span id=\'fancybox-title-over\'><span id=\'fancybox-title-pretext\'>'.__('Image','simplest-gallery').' "+(currentIndex+1)+" / " + currentArray.length + (title.length ? " </span>" + title : "") + "</span>"; }';(the first </span> tag has been moved a bit further in the line).
It might be interesting to integrate this in the next release and removing the useless “Image” hidden text.The above fix is untested, but it should work. Let me know if it worked for you.
Assuming issue is fixed, I close this ticket.
If more help is needed, just open a new one.
cleoni, please remind me how to access lightbox.php.
The safest way is to access your site’s files via FTP and you will find it into wp-content/plugins/simplest-gallery
There is also an editor in the backend (menu Plugin->Plugin editor, then select Simplest Gallery and that file).
Anyway please be advised that this requires a minimum of programming skills. With PHP files it is sufficient to put a character in the wrong position and your site might stop working (if it happens, use FTP to delete the plugin folder, then reinstall and redo).
Cheers
Thanks cleoni. You can close this now.
cleoni thanks but this didn’t work. It didn’t remove the ‘Image x/x’ from the captions.
I see. Let me check it on my own site.
I think this fix would be beneficial to all for the next release.
This image numbering is something which I would get gladly rid of.Much appreciated.
Hello, I have made a change in order to remove image number where a title has been set for the image (it will however show “Image N / NN” if no title has been set).
The change will be incorporated in the next release but since I don’t know when it will happen, and since it’s possible that in your website the code of lightbox has been twekaed already, I recommend you apply this fix simply by changing the lines 147-149 from:
"titleFormat" : function(title, currentArray, currentIndex, currentOpts) { return "<span id=\'fancybox-title-over\'><span id=\'fancybox-title-pretext\'>'.__('Image','simplest-gallery').' </span>"+(currentIndex+1)+" / " + currentArray.length + (title.length ? " " + title : "") + "</span>"; }';to this:
"titleFormat" : function(title, currentArray, currentIndex, currentOpts) { return "<span id=\'fancybox-title-over\'><span id=\'fancybox-title-pretext\'>" + (title.length ? title : ("'.__('Image','simplest-gallery').'" +(currentIndex+1)+" / "+currentArray.length) ) + "</span></span>"; }';Apply this fix on the file lightbox.php.
Save and then test.If it works, and you don’t wont the “Image #” to appear at all in any case, even when there is no title for the image, you can further replace this part
+ (title.length ? title : ("'.__('Image','simplest-gallery').'" +(currentIndex+1)+" / "+currentArray.length) ) +with this
+ title +You can see the fix in action at this page: https://vic20reloaded.com/vic-20-cartridge-games-collection-1a/
as you can see “Image N / NN” before the title does not appear.Hope it helps!
Yes! Thanks, that’s exactly what I needed. 🙂
The topic ‘Remove image number’ is closed to new replies.