function ktz_mustread_content() { global $post; if (ot_get_option('ktz_popup_activated') == 'yes') { $paged = get_query_var('paged') ? get_query_var('paged') : 1; $args = array('post_type' => 'post', 'orderby' => 'rand', 'order' => 'desc', 'showposts' => 3, 'post_status' => 'publish', 'ignore_sticky_posts' => 1); $ktz_topfeatquery = new WP_Query($args); if ($ktz_topfeatquery->have_posts()) { echo '<div id="ktz_slidebox">'; echo '<strong class="mustread_title">' . __('Must read', ktz_theme_textdomain) . '</strong><a href="#" class="close">×</a>'; echo '<ul class="mustread_list">'; while ($ktz_topfeatquery->have_posts()) { $ktz_topfeatquery->the_post(); echo '<li class="mustread_li clearfix">'; echo '<div class="pull-left">'; echo ktz_featured_img(50, 50); echo '</div>'; echo '<div class="title">'; echo ktz_posted_title_a(); echo '</div>'; echo '</li>'; } echo '</ul>'; echo '</div>'; } wp_reset_query(); } }
<article id="post-<?php the_ID(); ?> " <?php post_class('box-post ktz-archive'); ?> > <div class="entry-body media ktz-miniblog"> <?php $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url($thumb, 'full'); $fisrtimg_url = get_first_image_src(); $get_imgpost_upload = ktz_getpost_images_upload(); if ($img_url || $fisrtimg_url || $get_imgpost_upload) { echo '<div class="ktz-thumbwrap">'; echo ktz_featured_img(60, 60); // New kentooz image croping just call ktz_featured_img( width, height ) echo '<span class="fontawesome ktzfo-caret-right"></span>'; echo '</div>'; } ?> <div class="media-body ktz-post"> <?php ktz_posted_title_h('h2', 'entry-title ktz-titlemini'); ?> <div style="display:none;"> <?php do_action('ktz_author_by'); // function in _loop_ktz.php ?>
function ktz_relpost() { if (ot_get_option('ktz_active_related') == 'yes') { global $post; $orig_post = $post; $opsi_numberrelated = ot_get_option('ktz_numberpost_related'); $numberpost = !empty($opsi_numberrelated) ? $opsi_numberrelated : '4'; if (ot_get_option('ktz_taxonomy_relpost') == 'tags') { $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach ($tags as $individual_tag) { $tag_ids[] = $individual_tag->term_id; } $args = array('tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => $numberpost, 'ignore_sticky_posts' => 1); } } else { $categories = get_the_category($post->ID); if ($categories) { $category_ids = array(); foreach ($categories as $individual_category) { $category_ids[] = $individual_category->term_id; } $args = array('category__in' => $category_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => $numberpost, 'ignore_sticky_posts' => 1); } } if (!isset($args)) { $args = ''; } $ktz_query = new WP_Query($args); $i = 1; if ($ktz_query->have_posts()) { echo '<h2 class="related-title"><span>' . __('Related Post', ktz_theme_textdomain) . ' "' . get_the_title() . '"</span></h2>'; echo '<div class="ktz-related-post row">'; while ($ktz_query->have_posts()) { $ktz_query->the_post(); global $post; $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url($thumb, 'full'); $fisrtimg_url = get_first_image_src(); $get_imgpost_upload = ktz_getpost_images_upload(); if ($i % 2 == 0) { echo '<div class="col-md-6">'; echo '<div class="entry-body media ktz-miniblog">'; if ($img_url || $fisrtimg_url || $get_imgpost_upload) { echo '<div class="ktz-thumbwrap">'; echo ktz_featured_img(60, 60); // New kentooz image croping just call ktz_featured_img( width, height ) echo '<span class="fontawesome ktzfo-caret-right"></span>'; echo '</div>'; } echo '<div class="media-body ktz-post">'; ktz_posted_title_a(); echo '<div>'; echo ktz_get_excerpt(8); echo '</div>'; echo '</div>'; echo '</div>'; echo '</div>'; echo '<div class="clearfix"></div>'; } else { echo '<div class="col-md-6">'; echo '<div class="entry-body media ktz-miniblog">'; $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url($thumb, 'full'); $fisrtimg_url = get_first_image_src(); if ($img_url || $fisrtimg_url) { echo '<div class="ktz-thumbwrap">'; echo ktz_featured_img(60, 60); // New kentooz image croping just call ktz_featured_img( width, height ) echo '<span class="fontawesome ktzfo-caret-right"></span>'; echo '</div>'; } echo '<div class="media-body ktz-post">'; ktz_posted_title_a(); echo '<div>'; echo ktz_get_excerpt(8); echo '</div>'; echo '</div>'; echo '</div>'; echo '</div>'; } $i++; } echo '</div>'; } else { echo '<div class="no-post">No related post!</div>'; } $post = $orig_post; wp_reset_query(); } }
<?php /** * KENTOOZ DEFAULD POST TEMPLATE **/ ?> <article id="post-<?php the_ID(); ?> " <?php post_class('box-post ktz-archive'); ?> > <div class="entry-body media"> <?php echo ktz_featured_img(80, 80); // New kentooz image croping just call ktz_featured_img( width, height ) ?> <div class="media-body ktz-post"> <?php ktz_posted_title_h('h2', 'entry-title ktz-titlemini'); ?> <div style="display:none;"><?php hook_ktz_content_meta(); ?> </div> <div class="media-body ktz-post"> <?php hook_ktz_content(); ?>
function widget($args, $instance) { global $wpdb; $cache = wp_cache_get('widget_popular_posts', 'widget'); if (!is_array($cache)) { $cache = array(); } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $popular_by = empty($instance['popular_by']) ? 'comment' : $instance['popular_by']; $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']); $style_latest = empty($instance['style_latest']) ? 'list' : $instance['style_latest']; $popular_date = empty($instance['popular_date']) ? 'alltime' : $instance['popular_date']; $number = empty($instance['number']) ? '5' : $instance['number']; if ($popular_date == "yearly") { add_filter('posts_where', array($this, 'filter_where_yearly')); } elseif ($popular_date == "mountly") { add_filter('posts_where', array($this, 'filter_where_mountly')); } elseif ($popular_date == "weekly") { add_filter('posts_where', array($this, 'filter_where_weekly')); } elseif ($popular_date == "daily") { add_filter('posts_where', array($this, 'filter_where_daily')); } else { echo ""; } if ($popular_by == "comment") { $ktzpopular = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'order' => 'DESC')); } elseif ($popular_by == "view") { $ktzpopular = new WP_Query(array('showposts' => $number, 'post_type' => 'post', 'meta_key' => 'post_views_count', 'orderby' => 'meta_value_num', 'order' => 'desc', 'post_status' => 'publish', 'ignore_sticky_posts' => 1)); } else { $ktzpopular = new WP_Query(array('showposts' => $number, 'post_type' => 'post', 'meta_key' => 'ktz_stars_rating', 'orderby' => 'meta_value_num', 'order' => 'desc', 'post_status' => 'publish', 'ignore_sticky_posts' => 1)); } if ($popular_date == "yearly") { remove_filter('posts_where', array($this, 'filter_where_yearly')); } elseif ($popular_date == "mountly") { remove_filter('posts_where', array($this, 'filter_where_mountly')); } elseif ($popular_date == "weekly") { remove_filter('posts_where', array($this, 'filter_where_weekly')); } elseif ($popular_date == "daily") { remove_filter('posts_where', array($this, 'filter_where_daily')); } else { echo ""; } if ($ktzpopular->have_posts()) { echo $before_widget; if ($title) { echo '<h4 class="widget-title"><span class="ktz-blocktitle">'; echo $title; echo '</span>'; echo '</h4>'; } global $post; if ($style_latest == "list") { echo '<ul class="ktz-recent-list ktz-widgetcolor">'; while ($ktzpopular->have_posts()) { $ktzpopular->the_post(); echo '<li class="clearfix">'; echo ktz_featured_img(40, 40); echo ktz_posted_title_a(); echo '</li>'; } echo '</ul>'; } else { echo '<ul class="ktz-widgetcolor ktz_widget_default">'; while ($ktzpopular->have_posts()) { $ktzpopular->the_post(); echo '<li>'; echo ktz_posted_title_a(); echo '</li>'; } echo '</ul>'; } wp_reset_query(); } echo $after_widget; $cache[$args['widget_id']] = ob_get_flush(); wp_cache_add('widget_popular_posts', $cache, 'widget'); }
function widget($args, $instance) { $cache = wp_cache_get('widget_recent_posts', 'widget'); if (!is_array($cache)) { $cache = array(); } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $style_latest = empty($instance['style_latest']) ? 'list' : $instance['style_latest']; $cats = empty($instance['cats']) ? '' : $instance['cats']; $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']); $number = empty($instance['number']) ? '5' : $instance['number']; $ktzrecent = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'cat' => $cats)); if ($ktzrecent->have_posts()) { global $post; echo $before_widget; if ($title) { if ($title != '') { echo '<h4 class="widget-title'; if ($cats != '') { $cat_array = get_category($cats); echo ' ' . $cat_array->slug; } echo '">'; echo '<span class="ktz-blocktitle">' . $title . '</span>'; echo '</h4>'; } else { echo ''; } } if ($style_latest == "list") { echo '<ul class="ktz-recent-list ktz-widgetcolor'; if ($cats != '') { $cat_array = get_category($cats); echo ' ' . $cat_array->slug; } echo '">'; while ($ktzrecent->have_posts()) { $ktzrecent->the_post(); echo '<li class="clearfix">'; echo ktz_featured_img(40, 40); echo ktz_posted_title_a(); echo '</li>'; } echo '</ul>'; } elseif ($style_latest == "box") { echo '<div class="ktz-gallery ktz-boxgrid"><ul>'; while ($ktzrecent->have_posts()) { $ktzrecent->the_post(); echo '<li><a href="' . get_permalink() . '" title="' . get_the_title() . '">'; echo ktz_featured_just_img(120, 120); echo '</a></li>'; } echo '</ul></div>'; } else { echo '<ul class="ktz-widgetcolor ktz_widget_default'; if ($cats != '') { $cat_array = get_category($cats); echo ' ' . $cat_array->slug; } echo '">'; while ($ktzrecent->have_posts()) { $ktzrecent->the_post(); echo '<li>'; echo ktz_posted_title_a(); echo '</li>'; } echo '</ul>'; } wp_reset_query(); } echo $after_widget; $cache[$args['widget_id']] = ob_get_flush(); wp_cache_add('widget_recent_posts', $cache, 'widget'); }