?>
	
	<?php 
    } elseif (has_post_thumbnail()) {
        ?>
	<figure class="featured-image category">		
		<a href="<?php 
        the_permalink();
        ?>
" alt="<?php 
        the_title();
        ?>
">
			<?php 
        the_post_thumbnail();
        ?>
		</a>
		
		<?php 
        if (is_single() || is_page()) {
            ?>
			<?php 
            echo gk_post_thumbnail_caption();
            ?>
		<?php 
        }
        ?>
	</figure>
	<?php 
    }
}
/**
 *
 * Function to generate the post Social API elements
 *
 * @param title - title of the post
 * @param postID - ID of the post
 *
 * @return string - HTML output
 *
 **/
function gk_social_api($title, $postID)
{
    global $tpl;
    // check if the social api is enabled on the specific page
    $social_api_mode = get_option($tpl->name . '_social_api_exclude_include', 'exclude');
    $social_api_articles = explode(',', get_option($tpl->name . '_social_api_articles', ''));
    $social_api_pages = explode(',', get_option($tpl->name . '_social_api_pages', ''));
    $social_api_categories = explode(',', get_option($tpl->name . '_social_api_categories', ''));
    //
    $is_excluded = false;
    //
    if ($social_api_mode == 'include' || $social_api_mode == 'exclude') {
        //
        $is_excluded = ($social_api_pages != FALSE ? is_page($social_api_pages) : FALSE) || ($social_api_articles != FALSE ? is_single($social_api_articles) : FALSE) || ($social_api_categories != FALSE ? in_category($social_api_categories) : FALSE);
        //
        if ($social_api_mode == 'exclude') {
            $is_excluded = !$is_excluded;
        }
    }
    //
    if ($social_api_mode != 'none' && $is_excluded) {
        // variables for output
        $fb_like_output = '';
        $gplus_output = '';
        $twitter_output = '';
        $pinterest_output = '';
        // FB like
        if (get_option($tpl->name . '_fb_like', 'Y') == 'Y') {
            // configure FB like
            $fb_like_attributes = '';
            // configure FB like
            if (get_option($tpl->name . '_fb_like_send', 'Y') == 'Y') {
                $fb_like_attributes .= ' data-send="true"';
            }
            $fb_like_attributes .= ' data-layout="' . get_option($tpl->name . '_fb_like_layout', 'standard') . '"';
            $fb_like_attributes .= ' data-show-faces="' . get_option($tpl->name . '_fb_like_show_faces', 'true') . '"';
            $fb_like_attributes .= ' data-width="' . get_option($tpl->name . '_fb_like_width', '500') . '"';
            $fb_like_attributes .= ' data-action="' . get_option($tpl->name . '_fb_like_action', 'like') . '"';
            $fb_like_attributes .= ' data-font="' . get_option($tpl->name . '_fb_like_font', 'arial') . '"';
            $fb_like_attributes .= ' data-colorscheme="' . get_option($tpl->name . '_fb_like_colorscheme', 'light') . '"';
            $fb_like_output = '<div class="fb-like" data-href="' . get_permalink($postID) . '" ' . $fb_like_attributes . '></div>';
        }
        // G+
        if (get_option($tpl->name . '_google_plus', 'Y') == 'Y') {
            // configure +1 button
            $gplus_attributes = '';
            // configure +1 button attributes
            $gplus_attributes .= ' annotation="' . get_option($tpl->name . '_google_plus_count', 'none') . '"';
            $gplus_attributes .= ' width="' . get_option($tpl->name . '_google_plus_width', '300') . '"';
            $gplus_attributes .= ' expandTo="top"';
            if (get_option($tpl->name . '_google_plus_size', 'medium') != 'standard') {
                $gplus_attributes .= ' size="' . get_option($tpl->name . '_google_plus_size', 'medium') . '"';
            }
            $gplus_output = '<g:plusone ' . $gplus_attributes . ' callback="' . get_permalink($postID) . '"></g:plusone>';
        }
        // Twitter
        if (get_option($tpl->name . '_tweet_btn', 'Y') == 'Y') {
            // configure Twitter buttons
            $tweet_btn_attributes = '';
            $tweet_btn_attributes .= ' data-count="' . get_option($tpl->name . '_tweet_btn_data_count', 'vertical') . '"';
            if (get_option($tpl->name . '_tweet_btn_data_via', '') != '') {
                $tweet_btn_attributes .= ' data-via="' . get_option($tpl->name . '_tweet_btn_data_via', '') . '"';
            }
            $tweet_btn_attributes .= ' data-lang="' . get_option($tpl->name . '_tweet_btn_data_lang', 'en') . '"';
            $twitter_output = '<a href="http://twitter.com/share" class="twitter-share-button" data-text="' . strip_tags($title) . '" data-url="' . get_permalink($postID) . '" ' . $tweet_btn_attributes . '>' . __('Tweet', GKTPLNAME) . '</a>';
        }
        // Pinterest
        if (get_option($tpl->name . '_pinterest_btn', 'Y') == 'Y') {
            $pinit_title = gk_post_thumbnail_caption(true);
            if ($pinit_title == '') {
                $pinit_title = false;
            }
            $image = get_post_meta($postID, 'gavern_opengraph_image', true);
            if ($image == '') {
                $image = wp_get_attachment_image_src(get_post_thumbnail_id($postID), 'single-post-thumbnail');
                $image = $image[0];
                if ($image == '' && get_option($tpl->name . '_og_default_image', '') != '') {
                    $image = get_option($tpl->name . '_og_default_image', '');
                }
            }
            // configure Pinterest buttons
            $pinterest_btn_attributes = get_option($tpl->name . '_pinterest_btn_style', 'horizontal');
            $pinterest_output = '<a href="http://pinterest.com/pin/create/button/?url=' . get_permalink($postID) . '&amp;media=' . $image . '&amp;description=' . ($pinit_title == false ? urlencode(strip_tags($title)) : $pinit_title) . '" class="pin-it-button" count-layout="' . $pinterest_btn_attributes . '"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="' . __('Pin it', GKTPLNAME) . '" alt="' . __('Pin it', GKTPLNAME) . '" /></a>';
        }
        $output = '<section id="gk-social-api">' . apply_filters('gavern_social_api_fb', $fb_like_output) . apply_filters('gavern_social_api_gplus', $gplus_output) . apply_filters('gavern_social_api_twitter', $twitter_output) . apply_filters('gavern_social_api_pinterest', $pinterest_output) . '</section>';
        return apply_filters('gavern_social_api', $output);
    }
}