Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue][Request] Problem with captions in Advanced Gallery Block #590

Open
MarinaGR opened this issue Oct 8, 2024 · 0 comments
Open

[Issue][Request] Problem with captions in Advanced Gallery Block #590

MarinaGR opened this issue Oct 8, 2024 · 0 comments

Comments

@MarinaGR
Copy link

MarinaGR commented Oct 8, 2024

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.

Best regards,
Marina.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant