Problem with captions in Advanced Gallery Block
-
Hello,
I have created a Kadence Fluid carousel Gallery, which opens the images in Lightboxes. I need some of those images to go externally to another page, so I thought of adding a link in the caption of the image with the code
<a href="" target="_blank">TEXT</a>
.[Issue] In the thumbnail carousel the images are displayed correctly and the link is visible at the bottom of the image. However when I click to view it?in lightbox: the linked captions lose the link and only the text is displayed. Also,?images that have links as captions are duplicated?in the lightbox carousel.
[Request] Regarding the request (I don’t know if there is a specific section for it), it is related to the problem of losing the links in the Lightbox:
Can you add the tag ‘a’ for the links in the lightbox captions?
I was checking your code in case I could do it myself through some filter, but I only found ‘kadence_blocks_pro_dynamic_gallery_caption’ which is applied before.
I found that on line 769 of class-kadence-blocks-advancedgallery-block.php there is a call to ‘strip_tags( html_entity_decode($caption, ENT_QUOTES, ‘UTF-8’) )’ with no tags arguments allowed. It would be interesting if you could include link tag as a second argument:
$allowed_tags = '<a>'; [...] (Line 769) if ( ! empty( $href ) ) { $output .= '<a href="' . esc_url( $href ) . '"' . ( $link_to === 'media' && $lightbox === 'magnific' && $lightbox_cap && ! empty( $caption ) && is_string( $caption ) ? ' data-description="' . esc_attr( strip_tags( html_entity_decode($caption, ENT_QUOTES, 'UTF-8'), $allowed_tags ) ) . '"' : '' ) . '' . ( $link_to === 'media' && $lightbox === 'magnific' && ! empty( $image_alt ) && is_string( $image_alt ) ? ' data-alt="' . esc_attr( $image_alt ) . '"' : '' ) . ' class="kb-gallery-item-link" ' . ( ( $link_to === 'custom' && '_blank' === $link_target ) || ( $link_to === 'media' && $lightbox === 'new_tab' ) ? 'target="_blank"' : '' ) . ' ' . ( ( $link_to === 'custom' && ! empty( $rel_attr ) ) || ( $link_to === 'media' && ! empty( $rel_attr ) ) ? 'rel="' . esc_attr( $rel_attr ) . '"' : '' ) . '>'; }
Also the ‘strong’ tag for bold would be interesting.
As for the image duplication problem when opening in Lightbox images with links in caption I haven’t found yet in the code what might be happening.
Thanks for your work on this very complete plugin.
I look forward to your reply, thank you very much in advance.
P.S.: I don’t know if I posted in the right place, initial post here: Initial post in Github
Best regards,
Marina.
- You must be logged in to reply to this topic.