Created
May 24, 2014 19:56
-
-
Save evemilano/f2ab45ac28053fc6bc28 to your computer and use it in GitHub Desktop.
Ottimizzare le Meta Tag Open Graph su WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (have_posts()):while(have_posts()):the_post(); endwhile; endif;?> | |
<!-- the default values --> | |
<meta property="fb:app_id" content="your_fb_app_id" /> | |
<meta property="fb:admins" content="your_fb_admin_id" /> | |
<!-- if page is content page --> | |
<?php if (is_single()) { ?> | |
<meta property="og:url" content="<?php the_permalink() ?>"/> | |
<meta property="og:title" content="<?php single_post_title(''); ?>" /> | |
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" /> | |
<meta property="og:type" content="article" /> | |
<meta property="og:image" content="<?php if (function_exists('wp_get_attachment_thumb_url')) {echo wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID)); }?>" /> | |
<!-- if page is others --> | |
<?php } else { ?> | |
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" /> | |
<meta property="og:description" content="<?php bloginfo('description'); ?>" /> | |
<meta property="og:type" content="website" /> | |
<meta property="og:image" content="logo.jpg" /> <?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Leggi la guida: https://www.evemilano.com/2012/10/ottimizzare-meta-tag-open-grap-wordpress/