Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1315310

    pdopchev
    Participant

    Hi guys,

    Trying to add title/text under each photo in Envira gallery but couldn’t find such an option. Just like this gallery here (check screen grab) : https://travelcrestedbutte.com/crested-butte-snow-report/

    Is that possible?

    working on: http://www.enjoycrestedbutte.com/the-crested-butte-snow-report/

    Thank you!

    #1315392

    Rupok
    Member

    Hi there,

    Thanks for writing in! It’s possible if you use the default WordPress Gallery. If you need to show caption for Envira Gallery under the thumbnail, you can follow this – http://enviragallery.com/docs/display-image-captions-thumbnails/

    Cheers!

    #1315774

    pdopchev
    Participant

    Great! Thank you so much for the help!

    Was able to enable to title but noticed some misalignment when viewed on smaller screen. Is it possible to fix that?

    #1315964

    Rupok
    Member

    Hi there,

    Thanks for writing in! I can help with that. You can actually decrease the font size for smaller screens to keep it in single line. You can add this under Custom > CSS in the Customizer.

    @media only screen and (max-width: 480px) {
    .envira-gallery-item-inner .caption {
      font-size: 12px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: pre;
      width: 100%;
    }
    }

    You can change the max-width and font-size if needed.

    Cheers!

    #1316391

    pdopchev
    Participant

    That’s a nifty little trick! Thank you for the great support!

    #1316863

    Prasant Rai
    Moderator

    You are most welcome. 🙂

    #1337456

    pdopchev
    Participant

    Hi,

    Another question about captions under the images came to mind:

    1) How could I change the code below to make it on a global level (the code was taken from the link above: http://enviragallery.com/docs/display-image-captions-thumbnails/)

    #envira-gallery-321 .envira-gallery-item span.caption {
       padding: 0% 1% 3%;
       text-align: center;
       display: block;
    }
    .envira-gallery-item-inner .caption {
        white-space: pre-line;
        margin-top: 10px !important;
    }
    

    Pretty much looking to make the following line apply globally instead only to the specific gallery:

    #envira-gallery-321 .envira-gallery-item span.caption {

    Thank you!

    #1337758

    Lely
    Moderator

    Hello There,

    Please remove the #envira-gallery-321. Something like this:

    .envira-gallery-item span.caption {
       padding: 0% 1% 3%;
       text-align: center;
       display: block;
    }
    .envira-gallery-item-inner .caption {
        white-space: pre-line;
        margin-top: 10px !important;
    }

    Hope this helps.

    #1338390

    pdopchev
    Participant

    Awesome! Thank you so much!

    #1338512

    Rahul
    Moderator

    You’re most welcome!

    Let us know if we can help with anything else.

    Thanks!

    #1405871

    pdopchev
    Participant

    Hi guys,

    Just ran into an issue on this topic!

    Updated the code below which is located in envira-gallery-image-captions.php in wp/contents/plugins and it breaks the website. Am I missing something?

    // IDs of galleries to display captions on
        $galleriesToShowCaptions = array(358, 321, 632, 758, 2494, 2479, 2465, 2463, 2443, 2440, 2426, 2420, 2415, 2401, 2384, 2369, 2366, 2347, 2344, 2329, 2326, 2310, 2309, 2297, 2294, 2272, 2269, 2238, 2234, 2207, 2204, 2177, 2175, 2160, 2156, 2140, 2134, 2121, 2103, 2102, 2058, 2059, 2032, 2053, 2017, 2027, 1988, 2015, 1981, 1960, 1957, 1941, 1935, 1912, 1906, 1890, 1885, 1871, 1861, 1849, 1843, 1776, 1580, 1547, 830, 812, 758, 632);
         
    // Check if we need to display captions on this gallery
        if ( !in_array( $data['id'], $galleriesToShowCaptions ) ) {
            return $output;
        }
        if ( isset( $item['caption'] )) {
            $output .= '<span class="caption">' . $item['caption'] . '</span>';
        }
        return $output;
         
    }
    add_action( 'envira_gallery_output_after_link', 'envira_gallery_image_captions', 10, 5 );

    p.s. the code is inactive at the moment (need to keep the website running)

    By the way, also noticed that Envira gallery has added an options to display the title under the image in the config area, which is currently missing in the version Theme X is currently using… http://enviragallery.com/docs/display-image-captions-thumbnails/

    #1406390

    Lely
    Moderator

    Hi There,

    Would you mind giving us FTP credentials so we can check the file envira-gallery-image-captions.php?
    Please note that not all options and functionalities are available on the addon.

    #1406449

    pdopchev
    Participant
    This reply has been marked as private.
    #1406690

    Lely
    Moderator

    Hi There,

    When you say inactive, did you mean you remove the file totally or just commented the code? I am able to check but cannot find the file. This means you remove it then? So I can check it at the moment. Just make sure that you have completely copied the code correctly. Above code is incomplete. You may compare to this:
    https://gist.githubusercontent.com/n7studios/ca189994931fcad5aa77/raw/bb26568776030505e22e2fee55b4f1317931fdea/envira-gallery-image-captions.php

    Hope this helps.

    #1407544

    pdopchev
    Participant

    Hi, the code was commented out but using the one you provided to compare to works! Just copied the # of the gallery from the first code. This is what is working:

    function envira_gallery_image_captions( $output, $id, $item, $data, $i ) {
    	
    	// IDs of galleries to display captions on
    	$galleriesToShowCaptions = array(
    		391,
    		392, 358, 321, 632, 758, 2494, 2479, 2465, 2463, 2443, 2440, 2426, 2420, 2415, 2401, 2384, 2369, 2366, 2347, 2344, 2329, 2326, 2310, 2309, 2297, 2294, 2272, 2269, 2238, 2234, 2207, 2204, 2177, 2175, 2160, 2156, 2140, 2134, 2121, 2103, 2102, 2058, 2059, 2032, 2053, 2017, 2027, 1988, 2015, 1981, 1960, 1957, 1941, 1935, 1912, 1906, 1890, 1885, 1871, 1861, 1849, 1843, 1776, 1580, 1547, 830, 812, 758, 632	
    	);
    	
    	// Check if we need to display captions on this gallery
    	if ( !in_array( $data['id'], $galleriesToShowCaptions ) ) {
    		return $output;
    	}
    
    	if ( isset( $item['caption'] )) {
    		$output .= '<span class="caption">' . $item['caption'] . '</span>';
    	}
    
    	return $output;
    	
    }
    add_action( 'envira_gallery_output_after_link', 'envira_gallery_image_captions', 10, 5 );