fluidbox-wp icon indicating copy to clipboard operation
fluidbox-wp copied to clipboard

I have rel="lightbox[post-123]". How to customize fluidbox-custom.js?

Open ezkay opened this issue 10 years ago • 3 comments

I don't know how to also include the post-id after "lightbox".. Could you help me out here?

ezkay avatar Jun 07 '15 16:06 ezkay

On the post edit page, part of the URL will be "post=xxx", where xxx is the post ID. Alternatively, you don't have to include the post ID at all. simply having rel=lightbox will work, too.

peiche avatar Jun 08 '15 14:06 peiche

I understand that i only would need rel=lightbox. But i have a plugin that adds 'rel=lightbox[post-xxx]'. They say it's to navigate thru all images of the post. I also understand that. Just to get this right, fluidbox can navigate thru all images with just having rel=lightbox? Than, it seems like i don't need the plugin to add the post-id. But than i don't know how to add the rel=lightbox (without id). Thats why i thought to maybe let the fluidbox-custom.js search for the [id] too. Hope i'm not bothering you too much. Really appreciate that you're taking the time!

ezkay avatar Jun 08 '15 14:06 ezkay

Added this to my functions.php: add_filter('the_content', 'addlightboxrel', 12); add_filter('get_comment_text', 'addlightboxrel'); function addlightboxrel ($content) { global $post; $pattern = "/<a(.*?)href=('|\")([^>]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i"; $replacement = '<a$1href=$2$3.$4$5 rel="lightbox"$6>$7</a>'; $content = preg_replace($pattern, $replacement, $content); return $content; }

That adds just a rel=lightbox as you can see here: bildschirmfoto 2015-06-09 um 15 59 30

fluidbox-custom.php looks like this: jQuery(document).ready(function(){ jQuery('a[rel^="lightbox"]').fluidbox(); });

But still doesn't show up. I still get linked to the image in a new tab.

ezkay avatar Jun 09 '15 14:06 ezkay