/** * * 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 dp_social_api($title, $postID) { global $dynamo_tpl; // check if the social api is enabled on the specific page $social_api_mode = get_option($dynamo_tpl->name . '_social_api_exclude_include', 'exclude'); $social_api_articles = explode(',', get_option($dynamo_tpl->name . '_social_api_articles', '')); $social_api_pages = explode(',', get_option($dynamo_tpl->name . '_social_api_pages', '')); $social_api_categories = explode(',', get_option($dynamo_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($dynamo_tpl->name . '_fb_like', 'Y') == 'Y') { // configure FB like $fb_like_attributes = ''; // configure FB like if (get_option($dynamo_tpl->name . '_fb_like_send', 'Y') == 'Y') { $fb_like_attributes .= ' data-send="true"'; } $fb_like_attributes .= ' data-layout="' . get_option($dynamo_tpl->name . '_fb_like_layout', 'standard') . '"'; $fb_like_attributes .= ' data-show-faces="' . get_option($dynamo_tpl->name . '_fb_like_show_faces', 'true') . '"'; $fb_like_attributes .= ' data-width="' . get_option($dynamo_tpl->name . '_fb_like_width', '500') . '"'; $fb_like_attributes .= ' data-action="' . get_option($dynamo_tpl->name . '_fb_like_action', 'like') . '"'; $fb_like_attributes .= ' data-font="' . get_option($dynamo_tpl->name . '_fb_like_font', 'arial') . '"'; $fb_like_attributes .= ' data-colorscheme="' . get_option($dynamo_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($dynamo_tpl->name . '_google_plus', 'Y') == 'Y') { // configure +1 button $gplus_attributes = ''; // configure +1 button attributes $gplus_attributes .= ' annotation="' . get_option($dynamo_tpl->name . '_google_plus_count', 'none') . '"'; $gplus_attributes .= ' width="' . get_option($dynamo_tpl->name . '_google_plus_width', '300') . '"'; $gplus_attributes .= ' expandTo="top"'; if (get_option($dynamo_tpl->name . '_google_plus_size', 'medium') != 'standard') { $gplus_attributes .= ' size="' . get_option($dynamo_tpl->name . '_google_plus_size', 'medium') . '"'; } $gplus_output = '<g:plusone ' . $gplus_attributes . ' callback="' . get_permalink($postID) . '"></g:plusone>'; } // Twitter if (get_option($dynamo_tpl->name . '_tweet_btn', 'Y') == 'Y') { // configure Twitter buttons $tweet_btn_attributes = ''; $tweet_btn_attributes .= ' data-count="' . get_option($dynamo_tpl->name . '_tweet_btn_data_count', 'vertical') . '"'; if (get_option($dynamo_tpl->name . '_tweet_btn_data_via', '') != '') { $tweet_btn_attributes .= ' data-via="' . get_option($dynamo_tpl->name . '_tweet_btn_data_via', '') . '"'; } $tweet_btn_attributes .= ' data-lang="' . get_option($dynamo_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', DPTPLNAME) . '</a>'; } // Pinterest if (get_option($dynamo_tpl->name . '_pinterest_btn', 'Y') == 'Y') { $pinit_title = dp_post_thumbnail_caption(true); if ($pinit_title == '') { $pinit_title = false; } $image = get_post_meta($postID, 'dynamo_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($dynamo_tpl->name . '_og_default_image', '') != '') { $image = get_option($dynamo_tpl->name . '_og_default_image', ''); } } // configure Pinterest buttons $pinterest_btn_attributes = get_option($dynamo_tpl->name . '_pinterest_btn_style', 'horizontal'); $pinterest_output = '<a href="http://pinterest.com/pin/create/button/?url=' . get_permalink($postID) . '&media=' . $image . '&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', DPTPLNAME) . '" alt="' . __('Pin it', DPTPLNAME) . '" /></a>'; } if ($fb_like_output != '' || $gplus_output != '' || $twitter_output != '' || $pinterest_output != '') { $output = '<section id="dp-social-api">' . apply_filters('dynamo_social_api_fb', $fb_like_output) . apply_filters('dynamo_social_api_gplus', $gplus_output) . apply_filters('dynamo_social_api_twitter', $twitter_output) . apply_filters('dynamo_social_api_pinterest', $pinterest_output) . '</section>'; } else { $output = ''; } return apply_filters('dynamo_social_api', $output); } }
?> <div class="featured-image noscale"> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail(); ?> </a> <?php if (is_single()) { ?> <?php echo dp_post_thumbnail_caption(); ?> <?php } ?> </div> <?php if (get_post_meta($post->ID, 'item_type', true) == 'm') { echo print_html_images(htmlspecialchars_decode(get_post_meta($post->ID, "item_addimages", true)), 'all', '100%', '', '', false); } ?> <?php } } ?> <?php