"><?php the_title(); ?> </a></h2> <div class="meta"> <i class="fa fa-bookmark-o issticky"></i><a class="author" href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?> "><?php the_author(); ?> </a><a class="date" href="<?php the_permalink(); ?> "><?php kite_get_time(); ?> </a> <div class="likes button small rounded green"><?php echo esc_html(kite_get_post_number()); ?> </div> </div> <p><?php echo esc_html(kite_truncate_by_words(get_the_excerpt(), 200, ' [...]')); ?> </p> <div class="actions"> <a href="<?php the_permalink(); ?>
public function widget($args, $instance) { global $post; $kite_related_posts = get_posts(array('numberposts' => 2, 'category__in' => wp_get_post_categories($post->ID), 'meta_key' => '_thumbnail_id', 'post__not_in' => array($post->ID))); if (count($kite_related_posts) > 0) { ?> <section class="widget related_widget"> <h3><?php esc_html_e('Related Articles', 'kite'); ?> </h3> <?php foreach ($kite_related_posts as $post) { setup_postdata($post); $kite_thumb_id = get_post_thumbnail_id(); $kite_thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'postbg1'); ?> <article> <a href="<?php the_permalink(); ?> " class="postimage" style="background-image:url('<?php echo esc_url($kite_thumb_url[0]); ?> ');"></a> <h4><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h4> <p class="meta"><a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?> "><?php the_author(); ?> </a> / <a href="<?php the_permalink(); ?> "><?php kite_get_time(); ?> </a></p> </article> <?php } wp_reset_postdata(); ?> </section> <?php } }