<header class="entry-header text-center background-image" style="background-image: url(<?php echo sunset_get_attachment(); ?> );"> <?php the_title('<h1 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h1>'); ?> <div class="entry-meta"> <?php echo sunset_posted_meta(); ?> </div> <div class="entry-excerpt image-caption"> <?php the_excerpt(); ?> </div> </header> <footer class="entry-footer"> <?php echo sunset_posted_footer(); ?> </footer> </article>
public function widget($args, $instance) { $tot = absint($instance['tot']); $posts_args = array('post_type' => 'post', 'posts_per_page' => $tot, 'meta_key' => 'sunset_post_views', 'orderby' => 'meta_value_num', 'order' => 'DESC'); $posts_query = new WP_Query($posts_args); echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } if ($posts_query->have_posts()) { //echo '<ul>'; while ($posts_query->have_posts()) { $posts_query->the_post(); echo '<div class="media">'; echo '<div class="media-left"><img class="media-object" src="' . get_template_directory_uri() . '/img/post-' . (get_post_format() ? get_post_format() : 'standard') . '.png" alt="' . get_the_title() . '"/></div>'; echo '<div class="media-body">'; echo '<a href="' . get_the_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a>'; echo '<div class="row"><div class="col-xs-12">' . sunset_posted_footer(true) . '</div></div>'; echo '</div>'; echo '</div>'; } //echo '</ul>'; } echo $args['after_widget']; }