/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { extract($args); $title = !empty($instance['title']) ? $instance['title'] : ''; $number_posts = !empty($instance['number_posts']) ? absint($instance['number_posts']) : 5; $sticky_posts = isset($instance['sticky_posts']) ? $instance['sticky_posts'] : false; $category = $instance['category']; $offset = !empty($instance['offset']) ? absint($instance['offset']) : 0; // Latest Posts $latest_posts = new WP_Query(array('cat' => $category, 'posts_per_page' => $number_posts, 'post_status' => 'publish', 'ignore_sticky_posts' => $sticky_posts, 'offset' => $offset)); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } ?> <div class="awaken-3latest"> <div class="row"> <?php global $awaken_options; ?> <?php $i = 1; ?> <?php if ($latest_posts->have_posts()) { while ($latest_posts->have_posts()) { $latest_posts->the_post(); ?> <div class="col-xs-12 col-sm-4 col-md-4"> <div class="awaken-block-post"> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_post_thumbnail('featured', array('title' => get_the_title())); ?> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><img src="<?php echo get_template_directory_uri(); ?> /images/thumbnail-default.jpg" alt="<?php the_title(); ?> " /></a> <?php } ?> <?php the_title(sprintf('<h1 class="genpost-entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>'); ?> <?php if ('post' == get_post_type()) { ?> <div class="genpost-entry-meta"> <?php awaken_posted_on(); ?> <?php if ($awaken_options) { if ($awaken_options['awaken-post-comments'] == '1') { if (!post_password_required() && (comments_open() || '0' != get_comments_number())) { ?> <span class="comments-link"><?php comments_popup_link(__('Comment', 'awaken'), '1', '%'); ?> </span> <?php } } } else { if (!post_password_required() && (comments_open() || '0' != get_comments_number())) { ?> <span class="comments-link"><?php comments_popup_link(__('Comment', 'awaken'), '1', '%'); ?> </span> <?php } } ?> </div><!-- .entry-meta --> <?php } ?> <div class="genpost-entry-content mag-summary"><?php the_excerpt(); ?> </div> </div><!-- .awaken-block-post--> </div><!-- .bootstrap-cols --> <?php if ($i % 3 == 0) { echo '</div><!--.row--><div class="row">'; } ?> <?php $i++; ?> <?php } ?> <?php } ?> </div><!-- .row --> </div> <?php echo $after_widget; }
<article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <header class="single-entry-header"> <?php the_title('<h1 class="single-entry-title">', '</h1>'); ?> <div class="single-entry-meta"> <?php awaken_posted_on(); ?> <?php edit_post_link(__('Edit', 'awaken'), '<span class="edit-link">', '</span>'); ?> </div><!-- .entry-meta --> </header><!-- .entry-header --> <?php awaken_featured_image(); ?> <div class="entry-content"> <?php the_content(); ?>
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { extract($args); $title1 = !empty($instance['title1']) ? $instance['title1'] : ''; $number_posts1 = !empty($instance['number_posts1']) ? absint($instance['number_posts1']) : 5; $sticky_posts1 = isset($instance['sticky_posts1']) ? $instance['sticky_posts1'] : false; $category1 = $instance['category1']; $offset1 = !empty($instance['offset1']) ? absint($instance['offset1']) : 0; $title2 = !empty($instance['title2']) ? $instance['title2'] : ''; $number_posts2 = !empty($instance['number_posts2']) ? absint($instance['number_posts2']) : 5; $sticky_posts2 = isset($instance['sticky_posts2']) ? $instance['sticky_posts2'] : false; $category2 = $instance['category2']; $offset2 = !empty($instance['offset2']) ? absint($instance['offset2']) : 0; // Latest Posts 1 $latest_posts1 = new WP_Query(array('cat' => $category1, 'posts_per_page' => $number_posts1, 'post_status' => 'publish', 'ignore_sticky_posts' => $sticky_posts1, 'offset' => $offset1)); // Latest Posts 2 $latest_posts2 = new WP_Query(array('cat' => $category2, 'posts_per_page' => $number_posts2, 'post_status' => 'publish', 'ignore_sticky_posts' => $sticky_posts2, 'offset' => $offset2)); echo $before_widget; ?> <!-- Category 1 --> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-6"> <div class="awaken-dual-category"> <?php if (!empty($title1)) { echo $before_title . $title1 . $after_title; } ?> <?php $j = 1; ?> <?php global $awaken_options; ?> <?php if ($latest_posts1->have_posts()) { while ($latest_posts1->have_posts()) { $latest_posts1->the_post(); ?> <?php if ($j == 1) { ?> <div> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_post_thumbnail('featured', array('title' => get_the_title())); ?> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><img src="<?php echo get_template_directory_uri(); ?> /images/thumbnail-default.jpg" alt="<?php the_title(); ?> " /></a> <?php } ?> <?php the_title(sprintf('<h1 class="genpost-entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>'); ?> <?php if ('post' == get_post_type()) { ?> <div class="genpost-entry-meta"> <?php awaken_posted_on(); ?> <?php if ($awaken_options['awaken-post-comments'] == '1' && !post_password_required() && (comments_open() || '0' != get_comments_number())) { ?> <span class="comments-link"><?php comments_popup_link(__('Comment', 'awaken'), '1', '%'); ?> </span> <?php } ?> </div><!-- .entry-meta --> <?php } ?> <div class="genpost-entry-content dmag-summary"><?php the_excerpt(); ?> </div> </div> <?php } else { ?> <div class="ams-post"> <div class="ams-thumb"> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_post_thumbnail('small-thumb', array('title' => get_the_title())); ?> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><img src="<?php echo get_template_directory_uri(); ?> /images/mini-thumbnail-default.jpg" alt="<?php the_title(); ?> " /></a> <?php } ?> </div> <div class="ams-details"> <?php the_title(sprintf('<h1 class="ams-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>'); ?> <p class="ams-meta"><?php the_time('F j, Y'); ?> </p> </div> </div> <?php } ?> <?php $j++; ?> <?php } ?> <?php } ?> </div> </div><!-- bootstrap cols --> <!-- Category 2 --> <div class="col-xs-12 col-sm-6 col-md-6"> <div class="awaken-dual-category"> <?php if (!empty($title2)) { echo $before_title . $title2 . $after_title; } ?> <?php $j = 1; ?> <?php global $awaken_options; ?> <?php if ($latest_posts2->have_posts()) { while ($latest_posts2->have_posts()) { $latest_posts2->the_post(); ?> <?php if ($j == 1) { ?> <div> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_post_thumbnail('featured', array('title' => get_the_title())); ?> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><img src="<?php echo get_template_directory_uri(); ?> /images/thumbnail-default.jpg" alt="<?php the_title(); ?> " /></a> <?php } ?> <?php the_title(sprintf('<h1 class="genpost-entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>'); ?> <?php if ('post' == get_post_type()) { ?> <div class="genpost-entry-meta"> <?php awaken_posted_on(); ?> <?php if ($awaken_options['awaken-post-comments'] == '1' && !post_password_required() && (comments_open() || '0' != get_comments_number())) { ?> <span class="comments-link"><?php comments_popup_link(__('Comment', 'awaken'), '1', '%'); ?> </span> <?php } ?> </div><!-- .entry-meta --> <?php } ?> <div class="genpost-entry-content dmag-summary"><?php the_excerpt(); ?> </div> </div> <?php } else { ?> <div class="ams-post"> <div class="ams-thumb"> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_post_thumbnail('small-thumb', array('title' => get_the_title())); ?> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><img src="<?php echo get_template_directory_uri(); ?> /images/mini-thumbnail-default.jpg" alt="<?php the_title(); ?> " /></a> <?php } ?> </div> <div class="ams-details"> <?php the_title(sprintf('<h1 class="ams-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>'); ?> <p class="ams-meta"><?php the_time('F j, Y'); ?> </p> </div> </div> <?php } ?> <?php $j++; ?> <?php } ?> <?php } ?> </div> </div><!-- bootstrap cols --> </div><!-- .row --> <?php echo $after_widget; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { extract($args); $title = !empty($instance['title']) ? $instance['title'] : ''; $category = $instance['category']; // Latest Posts $latest_posts = new WP_Query(array('cat' => $category, 'posts_per_page' => 5, 'post_status' => 'publish', 'ignore_sticky_posts' => 'true')); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } ?> <div class="awaken-one-category"> <div class="row"> <?php $i = 1; ?> <?php if ($latest_posts->have_posts()) { while ($latest_posts->have_posts()) { $latest_posts->the_post(); ?> <?php if ($i == 1) { ?> <div class="col-xs-12 col-sm-6 col-md-6"> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_post_thumbnail('featured', array('title' => get_the_title())); ?> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><img src="<?php echo get_template_directory_uri(); ?> /images/thumbnail-default.jpg" alt="<?php the_title(); ?> " /></a> <?php } ?> <?php the_title(sprintf('<h1 class="genpost-entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>'); ?> <?php if ('post' == get_post_type()) { ?> <div class="genpost-entry-meta"> <?php awaken_posted_on(); ?> <?php if (get_theme_mod('display_post_comments', 1)) { if (!post_password_required() && (comments_open() || '0' != get_comments_number())) { ?> <span class="comments-link"><?php comments_popup_link(__('Comment', 'awaken'), '1', '%'); ?> </span> <?php } } ?> </div><!-- .entry-meta --> <?php } ?> <div class="genpost-entry-content mag-summary"><?php the_excerpt(); ?> </div> </div> <div class="col-xs-12 col-sm-6 col-md-6"> <?php } else { ?> <div class="ams-post"> <div class="ams-thumb"> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_post_thumbnail('small-thumb', array('title' => get_the_title())); ?> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><img src="<?php echo get_template_directory_uri(); ?> /images/mini-thumbnail-default.jpg" alt="<?php the_title(); ?> " /></a> <?php } ?> </div> <div class="ams-details"> <?php the_title(sprintf('<h1 class="ams-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>'); ?> <p class="ams-meta"><?php the_time('F j, Y'); ?> </p> </div> </div> <?php } ?> <?php $i++; ?> <?php } ?> </div><!-- .bootstrap cols --> <?php } ?> </div><!-- .row --> </div> <?php echo $after_widget; }