-
AuthorPosts
-
April 8, 2020 at 10:43 pm #1202037
Is there a way to add a title to an image in Lightbox when the image is in a regular Text Block? For this project, the galleries and the Image Element don’t look right for what I need, but I can’t seem to find a way to add a short bit of text for a title under the image when it opens up in the Lightbox. I tried adding text for the image in the WordPress Media library under Alternative Text, Caption and Description, but none of them seem to show up in the Text Block’s Image’s Lightbox.
Any ideas?
April 10, 2020 at 9:08 pm #1202754Hey rasa,
Could you please attach a mockup of what you’re trying to achieve?
Best regards,
VictoriaApril 10, 2020 at 10:03 pm #1202768HI Victoria,
Pretty simple. I just want a title for a painting to show up below the image when the image is opened up in Lightbox view – from within a Text Block.
Here’s a mockup: http://starseedgallery.net/wp-content/uploads/2020/04/lightbox-scaled.jpg
April 11, 2020 at 4:10 pm #1202939Hi rasa,
The titles will show up when you add the titles to the imaged in the media library in the title and caption field.
Best regards,
VictoriaApril 11, 2020 at 7:51 pm #1202983Hi Victoria,
You would think so, but as I said, I added the title to both fields and it still does not show up. If I used the “Image element” from the Media elements, then yes, the title would show up, but I have inserted the images into a Text Block. When you click on the image from within a Text Block, the image opens up in the lightbox, but the title is not there. Check out “Exo Planets Triptych” on this page to see that. The title is in both the caption and title fields in the Media Library (I also put it in the description and the alternative text), but the title does not show up in the lightbox.
You can see the info on the bottom right (6/6) indicating that it is image six on a page with six images, but no title.
April 11, 2020 at 7:53 pm #1202984Hi Victoria,
I’m pasting the page link into the Private Content box. It maybe doesn’t show up properly in the comment text box.
April 12, 2020 at 1:15 am #1203009Hi,
Thank you for the link, as I understand you are adding your images to text block elements so if you use the “Text” tab in the element builder you can see the image code, like this:
Please try adding your title, such astitle="my title"
to the image code as shown in the screenshot, this will add the title to the lightbox image:
You can also use this function to add the title to future images added, it doesn’t correct images already posted, but will add the title for future images.
Try adding this code to the end of your functions.php file in Appearance > Editor:// ~~~~~~~~~~~~~~~~~~~~~ Add Image Title - Crunchify.com Tips ~~~~~~~~~~~~~~~~~~~~~~~~ function crunchify_add_image_title( $html, $id ) { $crunchify_attach = get_post($id); if (strpos($html, "title=")) { return $html; } else { $crunchifyTitle = esc_attr($crunchify_attach->post_title); return str_replace('<img', '<img title="' . $crunchifyTitle . '" ' , $html); } } add_filter( 'media_send_to_editor', 'crunchify_add_image_title', 15, 2 ); function crunchify_add_image_title_gallery( $content, $id ) { $crunchify_title = get_the_title($id); return str_replace('<a', '<a title="' . esc_attr($crunchify_title) . '" ', $content); } add_filter('wp_get_attachment_link', 'crunchify_add_image_title_gallery', 10, 4);
Best regards,
MikeApril 12, 2020 at 11:59 am #1203073I have the same problem: I add image using the Image bloc. In my Images library all field are filed: legend, title, description, alt…
Then I insert the image link to the file media, but except the image nothing show up such as caption.
How do you do that??April 12, 2020 at 4:00 pm #1203099Hi,
@ehquionest I believe you are referring to something different, the caption doesn’t show in the lightbox, for the caption to show on the page please enable the Image Caption option:
If this doesn’t help please open a new thread with more details and a link to the page so we can investigate. Typically an admin login also helps.Best regards,
MikeApril 12, 2020 at 5:53 pm #1203120Unfortunately I am using the Classic mode so I don’t have this window…
April 12, 2020 at 7:45 pm #1203143ehquionest, Switch to the Advanced Layout Builder! It’s the main reason Enfold is such an amazing theme!
April 15, 2020 at 6:35 am #1203852Hi ehquionest,
Could you post login details to your site in private so that we can have a closer look please? Also please point out where and how we can reproduce the problem you are having.
Best regards,
RikardApril 15, 2020 at 8:16 am #1203874Hi,
I created a post in draft, named “AAAA Test Enfold Lightbox”, you can test there… Login details in provate field…
Thank youApril 15, 2020 at 12:04 pm #1203933Hi,
@ehquionest It looks like you posted your login details, but I don’t see the URL to your site, please include.Best regards,
MikeApril 15, 2020 at 12:07 pm #1203935Sorry, here is the admin URL (private)…
April 17, 2020 at 5:08 am #1204595The solution I found is to add manually for each image in post the following code :
caption=’yes’
appearance=’on-hover’April 17, 2020 at 7:29 am #1204612Hi ehquionest,
Thanks for the update, so did you get things working as you wish?
Best regards,
RikardApril 17, 2020 at 3:36 pm #1204731It seems for any reason, that I can now insert medias (such as images) in classic mode as I could do in advanced mode. For each image I insert I need:
– lightbox effect when somebody click on the image
– caption only showing up when the mouse in on the pictureIs there any chance to set this by defaut, so I don’t have to change these settings for every single image I insert?
Thank you so much for your help !!- This reply was modified 4 years, 8 months ago by mark.
April 18, 2020 at 12:24 pm #1204887Hi,
Thanks for the login, I found your draft “AAAA Test Enfold Lightbox” but the shortcode was mal-formed so I adjusted it for you.
When editing the shortcode in your post, I recommend doing so in the “text” tab and not in the “visual” tab.
Unfortunately, there is not an option to set default options to the elements, so you will need to select these options when you add your image shortcode for each image.Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.