<?php ktz_setPostViews(get_the_ID()); //get view for single post ?> <div class="ktz-single-box"><div class="entry-body"> <h1 class="entry-title clearfix"><?php the_title(); ?> </h1> <div class="metasingle-aftertitle"> <div class="ktz-inner-metasingle"> <?php hook_ktz_content_single_meta(); ?> <?php echo ktz_getPostViews($post->ID); ?> <?php echo ktz_ajaxstar_SEO_single(); ?> <?php edit_post_link(__('Edit', ktz_theme_textdomain), '<span class="entry-edit"><span class="glyphicon glyphicon-edit"></span> ', '</span>'); ?> </div> </div> <?php $attachments = array_values(get_children(array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'))); foreach ($attachments as $k => $attachment) { if ($attachment->ID == $post->ID) { break; }
function ktz_content_single_threep_attachement() { global $post; if (ot_get_option('ktz_active_autocontent') == 'yes') { $category = get_the_category(); $content_format = ot_get_option('ktz_wall_autocontent_threep'); $ktz_autocontent = str_replace('%ktzblogname%', get_bloginfo('name'), $content_format); $ktz_autocontent = str_replace('%ktzhomeurl%', get_home_url(), $content_format); $ktz_autocontent = str_replace('%ktzblogdescription%', get_bloginfo('description'), $ktz_autocontent); $ktz_autocontent = str_replace('%ktztitle%', get_the_title(), $ktz_autocontent); $ktz_autocontent = str_replace('%ktzpermalink%', get_permalink(), $ktz_autocontent); $ktz_autocontent = str_replace('%ktzpostformat%', get_post_format(), $ktz_autocontent); $ktz_autocontent = str_replace('%ktzview%', ktz_getPostViews($post->ID), $ktz_autocontent); $ktz_autocontent = str_replace('%ktztag%', $tags_list = get_the_tag_list('', __(' ', ktz_theme_textdomain)), $ktz_autocontent); $ktz_autocontent = str_replace('%ktzauthor%', get_the_author(), $ktz_autocontent); $ktz_autocontent = str_replace('%ktzcategory%', get_the_category_list(__(', ', ktz_theme_textdomain)), $ktz_autocontent); $ktz_autocontent = str_replace('%ktzdate%', get_the_date(), $ktz_autocontent); return $ktz_autocontent; } else { echo ''; } }
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>'; echo '<a href="' . get_permalink() . '" title="Permalink to ' . get_the_title() . '">'; echo '<img src="'; ktz_featured_just_img_link(230, 80); echo '" data-src="'; ktz_featured_just_img_link(230, 80); echo '" class="media-object ktz-lazyload" alt="' . get_the_title() . '" width="auto" height="auto" title="' . get_the_title() . '" />'; echo '</a>'; echo '<div class="ktz-content-related clearfix">'; echo '<div class="ktz-posttitle">'; echo ktz_posted_title_a(); echo '</div>'; echo '<div class="ktz-metapost-widget">'; if ($popular_by == "comment") { echo ktz_comment_num(); } elseif ($popular_by == "view") { echo ktz_getPostViews(get_the_ID()); } else { echo ktz_ajaxstar_SEO_widget(); } echo '</div>'; echo '</div></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'); }