WordPress.org

Forums

Add social share buttons for each gallery image (1 post)

  1. squizeers
    Member
    Posted 3 years ago #

    I am using the latest version of wordpress 3.3.1 with twentyeleven template. I want to have socical share button for each image in a gallery. I found that I have to modify the media.php file. But have no idea how to do it. Any help will be much appreciated. I am looking at the following code at media.php.:

    foreach ( $attachments as $id => $attachment ) {
    			$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
    
    			/////////////////////IMAGE CONTAINER/////////////////////
    			$output .= "<{$itemtag} class='gallery-item'>";
    
    				/////////////////////IMAGE/////////////////////
    				$output .= "<{$icontag} class='gallery-icon'>
    						$link
    							</{$icontag}>";
    				/////////////////////IMAGE/////////////////////
    
    				/////////////////////IMAGE CAPTION/////////////////////
    				if ( $captiontag && trim($attachment->post_excerpt) ) {
    					$output .= "
    						<{$captiontag} class='wp-caption-text gallery-caption'>
    
    						<div> " . wptexturize($attachment->post_excerpt) . " </div>.
    
    						</{$captiontag}>";
    				}
    
    				$img_desc.
    
    				/////////////////////IMAGE CAPTION/////////////////////
    
    			$output .= "</{$itemtag}>";
    			/////////////////////IMAGE CONTAINER END/////////////////////
    
    			if ( $columns > 0 && ++$i % $columns == 0 )
    				$output .= '<br style="clear: both" />';
    
    	}

Topic Closed

This topic has been closed to new replies.

About this Topic