static function get_image($post_id, $args = array())
{
$image = '';
/**
* Fires before we find a single good image for a specific post.
*
* @since 2.2.0
*
* @param int $post_id Post ID.
*/
do_action('jetpack_postimages_pre_get_image', $post_id);
$media = self::get_images($post_id, $args);
if (is_array($media)) {
foreach ($media as $item) {
if ('image' == $item['type']) {
$image = $item;
break;
}
}
}
/**
* Fires after we find a single good image for a specific post.
*
* @since 2.2.0
*
* @param int $post_id Post ID.
*/
do_action('jetpack_postimages_post_get_image', $post_id);
return $image;
}
/** * Get an image from a post * * @uses Jetpack_PostImages::get_image( $post_id ) to get the source of an image in a post, apply_filters() * * @since 1.0 * * @return string $the_image the image source */ function colorposts_get_post_image() { $post_id = get_the_ID(); if (class_exists('Jetpack_PostImages')) { $the_image = Jetpack_PostImages::get_image($post_id); if (!empty($the_image['src'])) { $the_image = $the_image['src']; } else { $the_image = apply_filters('jetpack_open_graph_image_default', "http://wordpress.com/i/blank.jpg"); } } $the_image = apply_filters('colorposts_image_output', $the_image); return esc_url($the_image); }