Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
  • #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?


    Hey rasa,

    Could you please attach a mockup of what you’re trying to achieve?

    Best regards,


    HI 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:


    Hi 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,


    Hi 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.


    Hi Victoria,

    I’m pasting the page link into the Private Content box. It maybe doesn’t show up properly in the comment text box.


    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 as title="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 - 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);

    Code found here.

    Best regards,


    I 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??


    @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,


    Unfortunately I am using the Classic mode so I don’t have this window…


    ehquionest, Switch to the Advanced Layout Builder! It’s the main reason Enfold is such an amazing theme!


    Hi 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,


    I created a post in draft, named “AAAA Test Enfold Lightbox”, you can test there… Login details in provate field…
    Thank you


    @ehquionest It looks like you posted your login details, but I don’t see the URL to your site, please include.

    Best regards,


    Sorry, here is the admin URL (private)…


    The solution I found is to add manually for each image in post the following code :



    Hi ehquionest,

    Thanks for the update, so did you get things working as you wish?

    Best regards,


    It 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 picture

    Is 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 1 year, 1 month ago by  ehquionest.

    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,

Viewing 19 posts - 1 through 19 (of 19 total)

You must be logged in to reply to this topic.