<div id="content" class="span10 offset1" role="main"><?php if (of_get_option('author_box_image_' . $author_ID)) { $author_image = 'background-image:url(' . of_get_option("author_box_image_" . $author_ID) . '); background-size:cover;'; } else { $author_image = 'background-image:none;'; } ?> <div class="author-meta box"> <div class="author-header" style="height:300px; <?php echo $author_image; ?> "> <div class="author-image" style="bottom:-240px;"><?php if (!of_get_option('author_box_avatar_' . $author_ID)) { echo '<img src="' . blu_get_avatar_url(get_avatar(get_the_author_meta('ID'), 120)) . '">'; } else { echo '<img src="' . of_get_option('author_box_avatar_' . $author_ID) . '">'; } ?> </div> </div> <div class="author-body"> <h2 class="vcard author"> <span class="fn"> <?php echo $curauth->nickname; ?> </span> <small style="display:block;"><?php echo $curauth->first_name . ' ' . $curauth->last_name;
function get_post_image($post_id, $size = 'small', $author_fallback = true, $thumbnail_id = false) { // get thumbnail id if not present if ($thumbnail_id) { return wp_get_attachment_image_src($thumbnail_id, $size); } // if there's a custom thumbnail present then always fetch that if this is a thumbnail image $custom_thumbnail = get_post_meta($post_id, 'bluth_custom_thumbnail', true); if ($custom_thumbnail && !empty($custom_thumbnail['gallery_src']) && ($size == 'small' || $size == 'thumbnail' || $size == 'mini' || $size == 'share')) { $custom_thumbnail = wp_get_attachment_image_src($custom_thumbnail['gallery_id'], $size); return $custom_thumbnail[0]; } // if the post has a featured image, always display that $thumb_id = get_post_thumbnail_id($post_id); $thumb_url = wp_get_attachment_image_src($thumb_id, $size, false); if ($thumb_url[0]) { return $thumb_url[0]; } if (has_post_format('gallery', $post_id)) { // if it's a gallery post and doesn't have a featured image, then display the first image in the gallery $images = get_post_meta($post_id, 'blu_gallery', true); if (!empty($images[0]['gallery_src'])) { $first_gallery_image = wp_get_attachment_image_src($images[0]['gallery_id'], $size); return $first_gallery_image[0]; } } else { if (get_children(array('numberposts' => 1, 'post_parent' => $post_id, 'post_type' => 'attachment', 'post_status' => null, 'post_mime_type' => 'image'))) { $args = array('numberposts' => 1, 'order' => 'ASC', 'post_parent' => $post_id, 'post_type' => 'attachment', 'post_status' => null, 'post_mime_type' => 'image'); $images = get_children($args); // else display the first image in the post // $image = array_reverse($image); $image = current($images); $image = wp_get_attachment_image_src($image->ID, $size); return $image[0]; } else { if ($first_image = catch_that_image()) { // else try again to get the first image in the post return $first_image; } else { if ($author_fallback) { // if it can't find anything and the author fallback is enabled then display the authors image return blu_get_avatar_url(get_avatar(get_the_author_meta('ID'), $size)); } else { return false; } } } } }