Advance meta_tags like video embed and image urls can be automatically generated. Previously knowned as "Facebook and Digg Thumbnail generator" plugin. Author: Fedmich Author URI: http://fedmich.com/tools/facebook-and-digg-thumbnail-generator Version: 1.15.6 */ define("FBTHU_VERSION", "1.15.6"); function fbthu_social_img() { global $post; if (is_single() or is_page()) { $post_id = $post->ID; $pcontent = $post->post_content; $use_img = 0; $image = get_post_meta($post_id, 'thumbnail', true); if ($image) { $use_img = 1; } else { $image = get_post_meta($post_id, 'post_image', true); $use_img = 1; } if (!$image) { preg_match_all('/"; if (is_home() || is_front_page() ) { $fbthu_title = get_bloginfo( 'name' ); } else { $fbthu_title = get_the_title(); } $return_code[] = ''; $return_code[] = ''; $chkd = get_settings('fbthu_add_metaog') ? 0 : 1; if ($chkd) { $return_code[] = ''; } //optional items $chkd = get_settings('fbthu_add_metalocale') ? 0 : 1; if ($chkd) { $return_code[] = ''; } if (get_settings('fbthu_add_metadesc')) { $post_excerpt = get_the_excerpt(); if(! $post_excerpt){ $post_excerpt = $pcontent; } $post_excerpt = preg_replace("/(\n|
){1,}/", "\n", $post_excerpt); $post_excerpt = preg_replace("/( |\t){1,}/", ' ', $post_excerpt); $post_excerpt = strip_tags(strip_shortcodes($post_excerpt)); $excerpt_wordlength = 35; $excerpt_words = explode(' ', $post_excerpt, $excerpt_wordlength + 1); if(count($excerpt_words) > $excerpt_wordlength){ array_pop($excerpt_words); array_push($excerpt_words, '...'); $post_excerpt = implode(' ', $excerpt_words); } $post_excerpt = str_replace("\n", '
', $post_excerpt ); $return_code[] = ''; } $meta_imgs = array_unique($meta_imgs); if ($meta_imgs) { $return_code[] = ''; foreach ($meta_imgs as $img) { $return_code[] = ''; } } $chkd = get_settings('fbthu_embed_yt') ? 0 : 1; if ($chkd) { if ($meta_vids) { $return_code[] = ''; foreach ($meta_vids as $video_src) { $return_code[] = ''; } } } $return_code[] = ""; $return_code = implode("\n",$return_code); echo $return_code . "\r\n"; } } add_action('wp_head', 'fbthu_social_img'); function fbthu_set_plugin_meta($links, $file) { $plugin = plugin_basename(__FILE__); if ($file == $plugin) { return array_merge($links, array( sprintf('%s', __('Settings')) , sprintf('%s', __('Help and FAQ')) , sprintf(' %s' , __('Plugin Directory') ) ) ); } return $links; } add_filter('plugin_row_meta', 'fbthu_set_plugin_meta', 10, 2); function fbthu_namespace($htmlcode){ return "$output xmlns:og=\"http://ogp.me/ns#\""; } add_filter('language_attributes','fbthu_namespace'); include dirname(__FILE__) . "/fbthu-options.php";