web/wp-content/plugins/social/views/wp-admin/post/broadcast/facebook-link-preview.php
changeset 196 5e8dcbe22c24
equal deleted inserted replaced
195:c7c0fbc09788 196:5e8dcbe22c24
       
     1 <?php
       
     2 
       
     3 // expects the following variables to be passed in:
       
     4 // $service (current service)
       
     5 // $account (account this will be broadcast to)
       
     6 // $post (the WordPress post object)
       
     7 
       
     8 setup_postdata($post);
       
     9 $url_parts = parse_url(home_url());
       
    10 
       
    11 $thumbnail = $thumbnail_class = '';
       
    12 if (function_exists('has_post_thumbnail') and has_post_thumbnail($post->ID)) {
       
    13 	$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
       
    14 	$thumbnail = '<img src="'.$image[0].'" alt="'.__('Thumbnail image', 'social').'" />';
       
    15 	$thumbnail_class = 'has-img';
       
    16 }
       
    17 
       
    18 ?>
       
    19 <div class="facebook-link-preview <?php echo esc_attr($thumbnail_class); ?>">
       
    20 <?php
       
    21 echo $thumbnail; 
       
    22 ?>
       
    23 	<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
       
    24 	<h5><?php echo esc_html($url_parts['host']); ?></h5>
       
    25 	<?php the_excerpt(); ?>
       
    26 </div>