예제 #1
0
    ?>
	<meta property="og:type" content="article"/>
	<meta property="og:description" content="<?php 
    echo trim(strip_tags(get_the_excerpt()));
    ?>
"/>
	<meta property="article:published_time" content="<?php 
    echo get_the_time('Y-m-j H:i');
    ?>
">
	<meta property="article:modified_time" content="<?php 
    echo get_the_modified_time('Y-m-j H:i');
    ?>
">
	<meta property="article:section" content="<?php 
    echo ucfirst(wpgrade_main_category(get_the_category(), false));
    ?>
">
	<?php 
    $posttags = get_the_tags();
    if ($posttags) {
        ?>
		<?php 
        foreach ($posttags as $tag) {
            ?>
			<meta property="article:tag" content="<?php 
            echo $tag->name;
            ?>
">
		<?php 
        }
예제 #2
0
function wpgrade_facebook_opengraph()
{
    global $wpGrade_Options;
    echo "\n" . '<!-- facebook open graph stuff -->' . "\n";
    if ($wpGrade_Options->get('facebook_id_app')) {
        echo '<meta property="fb:app_id" content="' . $wpGrade_Options->get('facebook_id_app') . '"/>' . "\n";
    }
    if ($wpGrade_Options->get('facebook_admin_id')) {
        echo '<meta property="fb:admins" content="' . $wpGrade_Options->get('facebook_admin_id') . '"/>';
    }
    echo '<meta property="og:site_name" content="' . get_bloginfo("name") . '"/>' . "\n";
    global $wp;
    $current_url = add_query_arg($wp->query_string, '', home_url($wp->request));
    echo '<meta property="og:url" content="' . $current_url . '"/>' . "\n";
    global $pagename;
    if (!empty($pagename)) {
        echo '<meta property="og:title" content="' . $pagename . '" />' . "\n";
    }
    if (is_singular()) {
        global $post;
        setup_postdata($post);
        echo '<meta property="og:type" content="article"/>' . "\n";
        echo '<meta property="og:description" content="' . strip_tags(get_the_excerpt()) . '" />' . "\n";
        echo '<meta property="article:published_time"  content="' . get_the_time('Y-m-j') . '">' . "\n";
        echo '<meta property="article:section"         content="' . ucfirst(wpgrade_main_category(get_the_category(), false)) . '">' . "\n";
        $posttags = get_the_tags();
        if ($posttags) {
            foreach ($posttags as $tag) {
                echo '<meta property="article:tag"             content="' . $tag->name . '">' . "\n";
            }
        }
        echo '<meta property="og:image" content="' . wpgrade_get_socialimage() . '"/>' . "\n";
    }
    echo '<!-- end facebook open graph -->' . "\n";
}