Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Begin FB Sharing for WP by Chad Von Lind. Get the latest code here: http://vonlind.com/?p=539 -->
- <?php
- $thumb = get_post_meta($post->ID,'_thumbnail_id',false);
- $thumb = wp_get_attachment_image_src($thumb[0], false);
- $thumb = $thumb[0];
- $default_img = 'http://www.maskc.org/img/logo/MASKC.jpg';
- ?>
- <?php if(is_single() || is_page()) { ?>
- <meta property="og:type" content="article" />
- <meta property="og:title" content="<?php single_post_title(''); ?>" />
- <meta property="og:description" content="<?php
- while(have_posts()):the_post();
- $excerpt_truncated = get_the_excerpt();
- if ( strlen(get_the_excerpt()) > 274)
- {
- $excerpt_truncated = substr(get_the_excerpt(), 0, 274)."...";
- }
- $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $excerpt_truncated);
- echo apply_filters('the_excerpt_rss', $out_excerpt);
- endwhile; ?>" />
- <meta property="og:url" content="<?php the_permalink(); ?>"/>
- <meta property="og:image" content="<?php if ( $thumb[0] == null ) { echo $default_img; } else { echo $thumb; } ?>" />
- <?php } else { ?>
- <meta property="og:type" content="article" />
- <meta property="og:title" content="<?php bloginfo('name'); ?>" />
- <meta property="og:url" content="<?php bloginfo('url'); ?>"/>
- <meta property="og:description" content="<?php bloginfo('description'); ?>" />
- <meta property="og:image" content="<?php if ( $thumb[0] == null ) { echo $default_img; } else { echo $thumb; } ?>" />
- <?php } ?>
- <!-- End FB Sharing for WP -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement