public function widget($args, $instance) { if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $number = !empty($instance['number']) ? absint($instance['number']) : 5; if (!$number) { $number = 5; } $args_article = array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'order' => $instance['order'], 'orderby' => $instance['orderby']); if (is_array($instance['category'])) { $args_article['category__in'] = $instance['category']; } $r = new WP_Query(apply_filters('widget_posts_args', $args_article)); if ($r->have_posts()) { echo $args['before_widget']; if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ob_start(); $carousel_html = ''; ?> <?php while ($r->have_posts()) { $r->the_post(); ?> <div <?php post_class(); ?> > <?php cruxstore_post_thumbnail_image('cruxstore_square', 'img-responsive', false); ?> <div class="post-carousel-content"> <?php cruxstore_post_meta_categories(); ?> <h4><?php get_the_title() ? the_title() : the_ID(); ?> </h4> </div> <a href="<?php the_permalink(); ?> " class="post-carousel-link"></a> </div> <?php } ?> <?php wp_reset_postdata(); $carousel_html .= ob_get_clean(); if ($carousel_html) { $atts = array('desktop' => 1, 'tablet' => 1, 'mobile' => 1, 'navigation_always_on' => false, 'navigation_position' => 'center', 'carousel_skin' => 'white', 'gutters' => false); $carousel_ouput = cruxstore_render_carousel(apply_filters('cruxstore_render_args', $atts), '', 'cruxstore-owl-carousel'); echo str_replace('%carousel_html%', $carousel_html, $carousel_ouput); } echo $args['after_widget']; } }
/** * Display the post meta * @since 1.0.0 */ function cruxstore_post_meta() { ?> <div class="entry-meta"> <?php if ('post' == get_post_type()) { // Hide category and tag text for pages on Search ?> <?php cruxstore_post_meta_categories(); //cruxstore_post_meta_author(); cruxstore_post_meta_date(); cruxstore_post_meta_comments(); cruxstore_entry_share_social(); ?> <?php } // End if 'post' == get_post_type() ?> </div> <?php }