<header class="entry-header <?php echo $header_class; ?> "> <?php if (!is_single() && (is_home() || is_archive() || is_search())) { $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'boron-medium-thumbnail'); echo '<div class="single-image-container">'; if (!empty($img)) { echo '<img src="' . $img['0'] . '" class="single-post-image" alt="Post with image">'; } else { echo '<span class="post-no-image"></span>'; } echo '<div class="single-post-information">'; boron_category_list(get_the_ID()); echo '<span class="single-post-title">' . get_the_title() . '</span>'; echo '<span class="single-post-readmore">' . __('Read more', 'boron') . '</span>'; echo '</div>'; echo '<div class="single-post-overlay"></div>'; echo '</div>'; echo '<input type="hidden" class="single-post-url" value="' . get_the_permalink() . '">'; echo '</header><!-- .entry-header -->'; echo '<script type="text/template" class="single-post-template">'; echo boron_get_single_post(get_the_ID()); echo '</script>'; echo '<script type="text/template" class="single-post-side-template">'; echo boron_get_single_post_side(get_the_ID()); echo '</script>'; } ?> </article>
/** * Add extra return fields for rest api for Boron 1.0. * * @since Boron 1.0 * * @return string */ function boron_get_extra_fields($object, $field_name, $request) { if (isset($object['featured_media'])) { $image_id = (int) $object['featured_media']; $img = wp_get_attachment_image_src($object['featured_media'], 'boron-medium-thumbnail'); $image_src = $img['0']; } else { $image_src = null; } $extra = array(); $extra['image_src'] = $image_src; $extra['tag_list'] = boron_tag_list($object['id'], true); $extra['category_list'] = boron_category_list($object['id'], true); $extra['date_ago'] = human_time_diff(get_the_time('U', $object['id']), current_time('timestamp')) . ' ' . __('ago', 'boron'); $extra['comments'] = boron_comment_count($object['id']); $extra['post_template'] = boron_get_single_post($object['id']); $extra['post_side_template'] = boron_get_single_post_side($object['id']); $extra['post_classes'] = implode(' ', get_post_class('', $object['id'])); return $extra; }