add_filter( 'the_content', 'sharingButtons_addThis', 100 ); // Put AddThis buttons at the bottom of every post. function sharingButtons_addThis( $content ) { global $post; if(isset($post)) { //Set Pinterest image using "Get The Image" plugin by Justin Tadlock if ( function_exists( 'get_the_image' ) ) { $getTheImageOptions = array( 'meta_key' => array( 'Thumbnail', 'thumbnail' ), 'post_id' => $post->ID, 'attachment' => true, 'the_post_thumbnail' => true, 'size' => 'large', 'default_image' => false, 'order_of_image' => 1, 'link_to_post' => true, 'image_class' => false, 'image_scan' => false, 'width' => false, 'height' => false, 'format' => 'array', 'meta_key_save' => false, 'callback' => null, 'cache' => true, 'echo' => false ); $pinterest = get_the_image($getTheImageOptions); $pinterestURL = $pinterest['url']; } else { $pinterestURL = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); } } else { $pinterestURL = ""; } $currentURL = 'http://'.$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $content .= ' '; $content .= '
'; $content .= ' '; if(!empty($pinterestURL)) { $content .= ' '; } $content .= ' '; $content .= ' '; $content .= ' '; $content .= '
'; $content .= ' '; $content .= ' '; // Returns the content. return $content; }