![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
Tagged: image caption, Masonry Gallery, shortcode
-
AuthorPosts
-
February 16, 2017 at 10:12 pm #748153
Hi,
I have created a shortcode [lightboxbildanfrage] which works fine when I add it to the normal text block within a page.
But now I would like to add it in the image caption within the “Masonry Gallery”, looks like this:
But there the shortcode is not “executed”, it appears in the lightbox as “clear text”:
The shortcode, that I have created within the “Code Snippets” plugin is this:
// Add Shortcode function contentblock_lightboxbildanfrage() { return ' <span class="mfp-title"><a href="https://mywebsite.de/kontakt/bildanfrage/" title="Bild anfragen">Bild anfragen</a></span> '; } add_shortcode( 'lightboxbildanfrage', 'contentblock_lightboxbildanfrage' );
I would like this custom shortcode being “executed” within the lightbox (!) view of an image within the Masonry Gallery.
I need to work with a shortcode, so that I can easily change the content of it for ALL my images globally.Is there any chance or “hack” to get a shortcode “executed” within the image caption when using the Masonry Gallery element of ALB?
Thank you.————————————————
UPDATE:
I found this https://codex.wordpress.org/Plugin_API/Filter_Reference/img_caption_shortcode,
perhaps with this something can be “made”, so that a shortcode as mentioned above in Masonry Gallery image lightboxes is “executed”, but my PHP is too bad for getting this done, if someone could help me out please. Thank you!-
This topic was modified 7 years, 6 months ago by
BeeCee. Reason: added an Update
February 21, 2017 at 3:27 pm #750000Hey Chris,
We would be glad to help you with this customization, but at the moment there is no easy way to do this by using a small custom code snippet, so I am afraid its out of the scope of our support.
But please feel free to request such feature at our feature request system: https://kriesi.at/support/enfold-feature-requests/
This system allows us to keep track of user suggestions and lets you vote on the feature you would like to see the most. I am afraid though there is no guarantee that a feature will get implemented. If that’s something you really need you can always try to hire a developer for the task :)
Best regards,
YigitFebruary 21, 2017 at 4:08 pm #750022Thanks, I got the solution in a Facebook group, it is quite simple:
in
config-templatebuilder/avia-shortcodes/av-helper-masonry.phpI’ve made these changes, search for
extract(array_merge($defaults, $entry));
and then add directly below this:
$content = do_shortcode($content); $the_title = do_shortcode($the_title); $description = do_shortcode($description);
Note your changes (I do this in Evernote), because after a theme update, this might be lost! Works fine!
February 21, 2017 at 4:11 pm #750023Hi!
Glad you figured it out and thanks for sharing your solution!
Please create a child theme – http://kriesi.at/documentation/enfold/using-a-child-theme/ and move your modified element into your child theme – http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/
Best regards,
YigitJune 28, 2019 at 7:11 pm #1114348Hi! i need this exact thing, is super important that i have it. But your solution is not working for me. Is that the only change you did? plus when i enter those 3 lines in av-helper-masonry.php, the layout breaks.
Any idea will be super appreciated!
Thanx!
June 29, 2019 at 12:03 am #1114383Hey jjsabatino,
Please provide a link to your site so we can look into this further.
Best regards,
Jordan ShannonJune 29, 2019 at 3:05 pm #1114442Sure, i didn´t add it cause it´s not relevant but here it is on private content. It´s important because the client will be adding a lot of images and will change names. And with the shortcode it will be way easier to change a lot of names at once.
July 3, 2019 at 7:46 pm #1115546Hi jjsabatino,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
VictoriaOctober 30, 2020 at 5:51 am #1256970Hi, I have trouble similar to this. Is there a way to make forms shortcode work inside the mpf title area in lightbox? The shortcode works only when you open the portfolio page. I have tried to place the do shortcode line inside the masonry file but it didnt help.
What I wanted to achieve is that the visitors can already send inquiries while the lightbox image is open. Similar to Facebook where users can comment while image is open.
Hope you can help me.
Thanks!
-
This reply was modified 3 years, 10 months ago by
melaniecuando. Reason: Add what I want to achieve. Ty!
November 3, 2020 at 10:15 am #1257918Hi,
That might not be possible because the lightbox script only renders content of the title area based on the title or alt attribute of the image or the parent link, or based on the content of a specific container. You might have to render the form or shortcode somewhere else, then use a custom script to append it to the lightbox container or the title area. Unfortunately, this will require modifications that are beyond the scope of support.
Best regards,
Ismael -
This topic was modified 7 years, 6 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.