WordPress.org

Ready to get started?Download WordPress

Forums

Easy Image Gallery
[resolved] How to add Image descriptions (8 posts)

  1. zikril
    Member
    Posted 11 months ago #

    Hi there.. To the point. I have add image caption and description on images that i select for work with tis plugin. But when i look the preview, only image title that appear on the frame.

    How to add image description appear on preview not just image title. i have no programming experiance, please help with the code.

    Thanks a lot

    http://wordpress.org/plugins/easy-image-gallery/

  2. sumobi
    Member
    Plugin Author

    Posted 11 months ago #

    Download the latest version 1.0.4 and then add this to your theme's functions.php. This will make the lightbox use the image's caption + description

    /**
     * Filter Easy Image Gallery HTML to add description
     *
    */
    
    function my_child_theme_easy_image_gallery_description( $html, $rel, $image_link, $image_class, $image_caption, $image, $attachment_id, $post_id ) {
    
    	// get the image's description
    	$image_description = get_post( $attachment_id )->post_content ? get_post( $attachment_id )->post_content : '';
    
    	// add the description to the title attribute
    	if ( function_exists( 'easy_image_gallery_has_linked_images' ) && easy_image_gallery_has_linked_images() )
    		$html = sprintf( '<li><a %s href="%s" class="%s" title="%s - %s"><i class="icon-view"></i><span class="overlay"></span>%s</a></li>', $rel, $image_link, $image_class, $image_caption, $image_description, $image );
    	else
    		$html = sprintf( '<li>%s</li>', $image );
    
    	return $html;
    }
    add_filter( 'easy_image_gallery_html', 'my_child_theme_easy_image_gallery_description', 10, 8 );
  3. rkim777
    Member
    Posted 4 months ago #

    Hi. Is it possible to have only 1 main image appear but be able to use the Easy Image Gallery plugin to flip through multiple views of the main image?

    For example, if I want to show a table, can I have just the main image show on a page or in a post, and then when someone clicks it have them be able to flip through different views of it that I uploaded but hid to only show the main image?

  4. sumobi
    Member
    Plugin Author

    Posted 4 months ago #

    Yes, you could use CSS to do this easily. Simply hide all the thumbnails, but the first one with display: none. Then only the first thumbnail will show, and you can still view the others in the lightbox.

  5. rkim777
    Member
    Posted 4 months ago #

    Thank you for the reply. I apologize but I'm not a coder. Could you please show me how to do this or point me in the right direction? I appreciate your help and generosity with this plugin.

  6. sumobi
    Member
    Plugin Author

    Posted 4 months ago #

    Sure,

    Add this to your theme's CSS file (style.css)

    /* Hide all the thumbnails */
    .image-gallery li { display: none; }

    /* Make the first one visible */
    .image-gallery li:first-child { display: inline-block; }

  7. rkim777
    Member
    Posted 4 months ago #

    Thank you very much! I greatly appreciate your help and generosity!

  8. sumobi
    Member
    Plugin Author

    Posted 4 months ago #

    No problem, happy to help!

Reply

You must log in to post.

About this Plugin

About this Topic