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']; } ?> <ul class="kt_posts_carousel_widget"> <?php while ($r->have_posts()) { $r->the_post(); ?> <li <?php post_class('article-widget clearfix'); ?> > <?php kt_post_thumbnail_image('kt_widget_article_carousel', 'img-responsive'); ?> <div class="article-attr"> <h3 class="title"> <a href="<?php the_permalink(); ?> "> <?php get_the_title() ? the_title() : the_ID(); ?> </a> </h3> </div> </li> <?php } ?> </ul> <?php echo $args['after_widget']; wp_reset_postdata(); } }
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']; } ?> <ul class="kt-posts-widget"> <?php while ($r->have_posts()) { $r->the_post(); ?> <li> <?php kt_post_thumbnail_image('kt_small', 'img-responsive'); ?> <div class="content"> <a class="title-link" href="<?php the_permalink(); ?> "><?php get_the_title() ? the_title() : the_ID(); ?> </a> <div class="post-meta"> <span class="post-date">November 18, 2015</span> </div> </div> </li> <?php } ?> </ul> <?php echo $args['after_widget']; // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } }
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); $select_week = isset($instance['select_week']) ? $instance['select_week'] : true; $select_month = isset($instance['select_month']) ? $instance['select_month'] : true; $select_year = isset($instance['select_year']) ? $instance['select_year'] : true; $number = !empty($instance['number']) ? absint($instance['number']) : 5; if (!$number) { $number = 5; } $show_thumbnail = isset($instance['show_thumbnail']) ? $instance['show_thumbnail'] : true; echo $args['before_widget']; if ($title) { echo $args['before_title'] . $title . $args['after_title']; } if ($select_week || $select_month || $select_year) { $rand = rand(); $tabs = array(); if ($select_week) { $tabs[] = 'week'; } if ($select_month) { $tabs[] = 'month'; } if ($select_year) { $tabs[] = 'year'; } ?> <div class="kt_widget_tabs"> <ul class="clearfix kt-tabs-nav"> <?php if ($select_week) { ?> <li><a href="#kt_tab_week<?php echo $rand; ?> "><?php esc_html_e('1 Week', 'adroit'); ?> </a></li><?php } ?> <?php if ($select_month) { ?> <li><a href="#kt_tab_month<?php echo $rand; ?> "><?php esc_html_e('1 Month', 'adroit'); ?> </a></li><?php } ?> <?php if ($select_year) { ?> <li><a href="#kt_tab_year<?php echo $rand; ?> "><?php esc_html_e('1 year', 'adroit'); ?> </a></li><?php } ?> </ul> <div class="tabs-container"> <?php if (count($tabs)) { $argsp = array('posts_per_page' => $number, 'ignore_sticky_posts' => true, 'post_status' => 'publish', 'orderby' => 'meta_value_num', 'meta_key' => 'kt_post_views_count'); foreach ($tabs as $tab) { $argsn = $argsp; if ($tab == 'week') { $argsn['date_query'] = array(array('year' => date('Y'), 'week' => date('w'))); } elseif ($tab == 'month') { $argsn['date_query'] = array(array('after' => array('year' => date('Y'), 'month' => date('m') - 1, 'day' => date('d')), 'before' => array('year' => date('Y'), 'month' => date('m'), 'day' => date('d')), 'inclusive' => true)); } elseif ($tab == 'year') { $argsn['date_query'] = array(array('after' => array('year' => date('Y'), 'month' => date('m'), 'day' => date('d')), 'before' => array('year' => date('Y'), 'month' => date('m'), 'day' => date('d')), 'inclusive' => true)); } $query = new WP_Query(apply_filters('widget_posts_args', $argsn)); ?> <div id="kt_tab_<?php echo $tab; echo $rand; ?> " class="kt_tabs_content"> <?php if ($query->have_posts()) { ?> <ul> <?php while ($query->have_posts()) { $query->the_post(); ?> <li <?php post_class('article-widget clearfix'); ?> > <?php if ($show_thumbnail) { kt_post_thumbnail_image('kt_small', 'img-responsive'); } ?> <div class="article-attr"> <h3 class="title"><a href="<?php the_permalink(); ?> "><?php get_the_title() ? the_title() : the_ID(); ?> </a></h3> <div class="entry-meta-data"> <?php kt_entry_date(); kt_get_post_views(); ?> </div> </div> </li> <?php } wp_reset_postdata(); ?> </ul> <?php } ?> </div> <?php } } ?> </div> </div> <?php } echo $args['after_widget']; }
<article id="post-<?php the_ID(); ?> " <?php post_class('blog-post'); ?> itemscope="" itemtype="http://schema.org/BlogPosting"> <?php kt_post_thumbnail_image('kt_list'); ?> <?php kt_entry_date(); ?> <div class="blog-post-content"> <div class="blog-post-inner"> <?php the_title(sprintf('<h2 class="entry-title" itemprop="name headline"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>'); ?> <?php kt_entry_excerpt(); ?> <?php kt_entry_meta(); ?> <p class="entry-more"> <?php printf('<a href="%1$s" class="%2$s">%3$s</a>', esc_url(get_permalink(get_the_ID())), 'btn btn-default', sprintf(esc_html__('Read more %s', 'mondova'), '<span class="screen-reader-text">' . get_the_title(get_the_ID()) . '</span>')); ?> </p> </div> </div>
" <?php post_class('single-post'); ?> itemscope="" itemtype="http://schema.org/BlogPosting"> <div class="container"> <div class="row"> <div class="col-sm-8 col-md-8 col-xs-12 pull-right"> <div class="single-post-content"> <header class="entry-header"> <?php the_title(sprintf('<h1 class="entry-title" itemprop="name headline">', esc_url(get_permalink())), '</h1>'); kt_post_meta(); ?> </header><!-- .entry-header --> <?php kt_post_thumbnail_image('full', 'img-responsive', false, false); ?> <div class="entry-content clearfix" itemprop="articleBody"> <?php the_content(); ?> <?php if (!post_password_required()) { wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . esc_html__('Pages:', 'mondova') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', 'pagelink' => '<span class="screen-reader-text">' . esc_html__('Page', 'mondova') . ' </span>%', 'separator' => '<span class="screen-reader-text">, </span>')); } ?> </div><!-- .entry-content --> </div> </div> <div class="col-sm-4 col-md-4 col-xs-12 single-left"> <div class="single-left-content">
<div class="blog-post-content"> <?php the_title(sprintf('<h2 class="entry-title" itemprop="name headline"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>'); ?> <?php kt_entry_excerpt(); ?> <p class="entry-more"> <?php printf('<a href="%1$s" class="%2$s">%3$s</a>', esc_url(get_permalink(get_the_ID())), 'btn btn-default', sprintf(esc_html__('Read more %s', 'mondova'), '<span class="screen-reader-text">' . get_the_title(get_the_ID()) . '</span>')); ?> </p> </div> </div> </div> <div class="col-md-6 col-sm-12 col-xs-12"> <div class="col-inner"> <div class="blog-post-infos"> <?php kt_post_thumbnail_image('kt_zigzag'); ?> <?php kt_entry_meta(); ?> </div> </div> </div> </div> </article><!-- #post-## -->
<article <?php post_class('post-item-content'); ?> > <?php echo '<div class="post-item-thumb">'; kt_post_thumbnail_image('kt_recent_posts'); echo '</div>'; the_title(sprintf('<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>'); kt_entry_meta(); ?> </article>
<article id="post-<?php the_ID(); ?> " <?php post_class('blog-post'); ?> itemscope="" itemtype="http://schema.org/BlogPosting"> <div class="blog-post-content"> <?php kt_post_thumbnail_image('kt_grid'); ?> <?php kt_entry_date(); ?> <div class="blog-post-inner"> <?php the_title(sprintf('<h2 class="entry-title" itemprop="name headline"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>'); ?> <?php kt_entry_meta(); ?> <?php kt_entry_excerpt(); ?> <p class="entry-more"> <?php printf('<a href="%1$s" class="%2$s">%3$s</a>', esc_url(get_permalink(get_the_ID())), 'btn btn-default', sprintf(esc_html__('Read more %s', 'mondova'), '<span class="screen-reader-text">' . get_the_title(get_the_ID()) . '</span>')); ?> </p> </div> </div>
<article <?php post_class('post-item-content'); ?> > <?php echo '<div class="post-item-thumb">'; kt_post_thumbnail_image('kt_recent_posts_masonry'); echo '</div>'; the_title(sprintf('<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>'); kt_entry_meta_categories(); kt_entry_excerpt(); kt_entry_meta(); ?> </article>
<article <?php post_class('post-item-content'); ?> > <?php echo '<div class="post-item-thumb">'; kt_post_thumbnail_image('kt_blog_post'); echo '</div>'; ?> <div class="post-item-inner"> <?php the_title(sprintf('<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>'); ?> <div class="post-item-content"> <?php kt_entry_meta_categories(); the_content(sprintf(esc_html__('Continue reading %s', 'adroit'), ' <i class="fa fa-long-arrow-right"></i>')); kt_entry_meta(true); ?> </div> </div> </article>
function kt_render_postSlider($post_id) { $output = ''; $orderby = get_post_meta($post_id, '_kt_slideshow_orderby', true); $order = get_post_meta($post_id, '_kt_slideshow_order', true); $per_page = get_post_meta($post_id, '_kt_slideshow_max_items', true); $style = rwmb_meta('_kt_slideshow_slider_style', array(), $post_id); if (get_post_status($post_id) != 'publish') { return; } $args = array('post_type' => 'post', 'posts_per_page' => $per_page, 'orderby' => $orderby, 'order' => $order); if ($orderby == 'meta_value' || $orderby == 'meta_value_num') { $meta_key = get_post_meta($post_id, 'slideshow_meta_key', true); $args['meta_key'] = $meta_key; } $source = get_post_meta($post_id, '_kt_slideshow_source', true); if ($source == 'categories') { $categories = rwmb_meta('_kt_slideshow_categories', 'type=taxonomy_advanced&taxonomy=category', $post_id); if (count($categories)) { $categories_arr = array(); foreach ($categories as $category) { $categories_arr[] = $category->term_id; } $args['category__in'] = $categories_arr; } } elseif ($source == 'posts') { $posts = rwmb_meta('_kt_slideshow_posts', 'multiple=true', $post_id); if (count($posts)) { $args['post__in'] = $posts; } } elseif ($source == 'authors') { $authors = rwmb_meta('_kt_slideshow_authors', 'multiple=true', $post_id); if (count($authors)) { $args['author__in'] = $authors; } } $query = new WP_Query($args); $slider_html = ''; if ($query->have_posts()) { $slider_class = array('blog-posts-slick', 'posts-slick-' . $style); $image_size = 'kt_blog_post'; $slider_option = '{}'; $slider_thumbnail = ''; if ($style == 'big') { $slider_class[] = 'slideAnimation'; $slider_class[] = 'slide-visible'; $image_size = 'kt_blog_post_slider'; } elseif ($style == 'thumb') { $slider_option = '{"arrows": false, "asNavFor": ".blog-posts-thumb", "fade": true}'; $slider_thumbnail .= '<div class="blog-posts-thumb">'; } elseif ($style == 'slider') { $slider_class[] = 'slideAnimation'; } elseif ($style == 'carousel') { //$slider_option = '{"arrows": true, "slidesToShow": 3}'; } else { $slider_class[] = 'slideAnimation'; } while ($query->have_posts()) { $query->the_post(); $slider_content = ''; if ($style != 'thumb') { $content_class = ''; if ($style == 'slider') { $content_class = ''; } $slider_content = sprintf('<div class="article-post-content %1$s"><div class="article-post-inner">%2$s %3$s</div></div>', $content_class, '<h3><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></h3>', '<div class="article-post-meta">' . get_the_author() . ' - ' . get_the_date() . '</div>'); } if ($style == 'slider') { $slider_html .= sprintf('<div class="article-post" style="%s">%s</div>', "background-image: url('" . get_the_post_thumbnail_url() . "');", $slider_content); } else { $slider_html .= sprintf('<div class="article-post"><div class="article-post-thumb">%1$s</div>%2$s</div>', kt_post_thumbnail_image($image_size, 'img-responsive', false, true, false), $slider_content); } if ($style == 'thumb') { $slider_thumbnail .= sprintf('<div style="%s"><div class="blog-posts-thumb-content">%s %s</div></div>', "background-image: url('" . get_the_post_thumbnail_url() . "');", '<h4><a href="' . get_the_permalink() . '"> ' . get_the_title() . '</a></h4>', '<div class="article-thumb-meta">' . get_the_author() . ' - ' . get_the_date() . '</div>'); } } if ($style == 'thumb') { $slider_thumbnail .= '</div>'; } $output .= sprintf('<div class="%1$s" data-slick=\'%2$s\'>%3$s</div>%4$s', implode(' ', $slider_class), esc_attr($slider_option), $slider_html, $slider_thumbnail); } /* Restore original Post Data */ wp_reset_postdata(); return $output; }
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; $just_featured = isset($instance['just_featured']) ? $instance['just_featured'] : false; 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']; } if ($just_featured == true) { $args_article['meta_key'] = '_kt_post_featured'; $args_article['meta_value'] = 'yes'; } $r = new WP_Query(apply_filters('widget_posts_args', $args_article)); if ($r->have_posts()) { $layout = !empty($instance['layout']) ? absint($instance['layout']) : 1; if (!$layout) { $layout = 1; } echo $args['before_widget']; if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="kt_posts_widget kt-artilce-<?php echo esc_attr($layout); ?> "> <?php while ($r->have_posts()) { $r->the_post(); ?> <li <?php post_class('article-widget clearfix'); ?> > <?php if ($layout == 2) { kt_post_thumbnail_image('kt_recent_posts', 'img-responsive'); } else { kt_post_thumbnail_image('kt_widget_article', 'img-responsive'); } ?> <div class="article-attr"> <h3 class="title"><a href="<?php the_permalink(); ?> "><?php get_the_title() ? the_title() : the_ID(); ?> </a></h3> <?php $layout == 2 ? kt_entry_meta() : kt_entry_date(); ?> </div> </li> <?php } ?> </ul> <?php echo $args['after_widget']; // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } }
<article id="post-<?php the_ID(); ?> " <?php post_class('blog-post'); ?> itemscope="" itemtype="http://schema.org/BlogPosting"> <div class="blog-post-content"> <?php kt_post_thumbnail_image('kt_classic'); ?> <?php kt_entry_date(); ?> <div class="blog-post-inner"> <?php the_title(sprintf('<h3 class="entry-title" itemprop="name headline"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>'); ?> <?php kt_entry_meta(); ?> <div class="entry-content" itemprop="articleBody"> <?php /* translators: %s: Name of current post */ the_content(sprintf(__('Continue reading<span class="screen-reader-text"> "%s"</span>', 'mondova'), get_the_title())); wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'mondova') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', 'pagelink' => '<span class="screen-reader-text">' . __('Page', 'mondova') . ' </span>%', 'separator' => '<span class="screen-reader-text">, </span>')); ?> </div><!-- .entry-content --> <!--<p class="entry-more"> <?php printf('<a href="%1$s" class="%2$s">%3$s</a>', esc_url(get_permalink(get_the_ID())), 'btn btn-default', sprintf(esc_html__('Read more %s', 'mondova'), '<span class="screen-reader-text">' . get_the_title(get_the_ID()) . '</span>'));
<article <?php post_class('post-item-content first-featured'); ?> > <div class="row row-eq-height"> <div class="col-md-7"> <?php kt_post_thumbnail_image('kt_first_featured'); ?> </div> <div class="col-md-5 post-item-info"> <?php the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>'); kt_entry_meta_categories(); kt_entry_excerpt(); kt_entry_meta(true); ?> </div> </div> </article>