function render($td_column_number, $td_post_count, $td_unique_id_slide) { $buffy = ''; $buffy .= '<div id="' . $td_unique_id_slide . '_item_' . $td_post_count . '" class = "' . $this->get_module_classes(array("td-image-gradient")) . '">'; switch ($td_column_number) { case '1': //one column layout $buffy .= $this->get_image('td_324x400'); break; case '2': //two column layout $buffy .= $this->get_image('td_696x385'); break; case '3': //three column layout $buffy .= $this->get_image('td_1068x580'); break; } $buffy .= '<div class="td-slide-meta">'; if (td_util::get_option('tds_category_module_slide') == 'yes') { $buffy .= '<span class="slide-meta-cat">'; $buffy .= $this->get_category(); $buffy .= '</span>'; } $buffy .= $this->get_title(); //$this->get_title_main(); $buffy .= '<div class="td-module-meta-info">'; $buffy .= $this->get_author(); $buffy .= $this->get_date(); if (td_util::get_option('tds_p_show_views') != 'hide') { $buffy .= '<div class="td-post-views"><i class="td-icon-views"></i>' . td_page_views::get_page_views($this->post->ID) . '</div>'; } $buffy .= $this->get_comments(); $buffy .= '</div>'; $buffy .= '</div>'; $buffy .= '</div>'; return $buffy; }
function get_views() { $buffy = ''; if (td_util::get_option('tds_p_show_views') != 'hide') { $buffy .= '<div class="td-post-views">'; $buffy .= '<i class="td-icon-views"></i>'; // WP-Post Views Counter if (function_exists('the_views')) { $post_views = the_views(false); $buffy .= $post_views; } else { $buffy .= '<span class="td-nr-views-' . $this->post->ID . '">' . td_page_views::get_page_views($this->post->ID) . '</span>'; } $buffy .= '</div>'; } return $buffy; }
$tax_meta_sidebar = td_util::get_category_option($primary_category_id, 'tdc_sidebar_pos'); //swich by RADU A, get_tax_meta($primary_category_id, 'tdc_sidebar_pos'); if (!empty($tax_meta_sidebar)) { //update the sidebar position from the category setting $loop_sidebar_position = $tax_meta_sidebar; } } //read the custom single post settings - this setting overids all of them $td_post_theme_settings = get_post_meta($post->ID, 'td_post_theme_settings', true); if (!empty($td_post_theme_settings['td_sidebar_position'])) { $loop_sidebar_position = $td_post_theme_settings['td_sidebar_position']; } //set the content width if needed (we already have the default in functions) if ($loop_sidebar_position == 'no_sidebar') { $content_width = 980; } //send the sidebar position to gallery td_global::$cur_single_template_sidebar_pos = $loop_sidebar_position; //increment the views counter td_page_views::update_page_views($post->ID); //added by Radu A. check if this post have a post template to be display with. //if not use the default site post template from Theme Panel -> Post Settings -> Default site post template $td_default_site_post_template = td_util::get_option('td_default_site_post_template'); if (empty($td_post_theme_settings['td_post_template']) and !empty($td_default_site_post_template)) { $td_post_theme_settings['td_post_template'] = $td_default_site_post_template; } // sidebar position used to align the breadcrumb on sidebar left $td_sidebar_position = ''; if ($loop_sidebar_position == 'sidebar_left') { $td_sidebar_position = 'td-sidebar-left'; }
/** * Get the views counter for all posts on a page where unique articles is set */ function td_ajax_get_views() { //get the post ids // iy you don't send data encoded with json the remove json_decode(stripslashes( if (!empty($_POST['td_post_ids'])) { $td_post_ids = json_decode(stripslashes($_POST['td_post_ids'])); //will hold the return array $buffy = array(); //this check for arrays with values // and count($td_post_ids) > 0 if (!empty($td_post_ids) and is_array($td_post_ids)) { //this check for arrays with values foreach ($td_post_ids as $post_id) { $buffy[$post_id] = td_page_views::get_page_views($post_id); } //return the view counts die(json_encode($buffy)); } } }
function get_commentsAndViews() { $buffy = ''; $buffy .= '<div class="entry-comments-views">'; if (td_util::get_option('tds_p_show_comments') != 'hide') { //$buffy .= '<a href="' . get_comments_link($this->post->ID) . '">'; $buffy .= '<span class="td-sp td-sp-ico-comments td-fake-click" data-fake-click="' . get_comments_link($this->post->ID) . '"></span>'; $buffy .= get_comments_number($this->post->ID); //$buffy .= '</a>'; } if (td_util::get_option('tds_p_show_views') != 'hide') { $buffy .= ' '; $buffy .= '<span class="td-sp td-sp-ico-view"></span>'; // WP-Post Views Counter if (function_exists('the_views')) { $post_views = the_views(false); $buffy .= $post_views; } else { $buffy .= '<span class="td-nr-views-' . $this->post->ID . '">' . td_page_views::get_page_views($this->post->ID) . '</span>'; } } $buffy .= '</div>'; return $buffy; }
} } static function get_page_views($postID) { $count = get_post_meta($postID, self::$post_view_counter_key, true); if ($count == '') { delete_post_meta($postID, self::$post_view_counter_key); add_post_meta($postID, self::$post_view_counter_key, '0'); return "0"; } return $count; } static function hook_manage_posts_columns($defaults) { $defaults['td_post_views'] = 'Views'; return $defaults; } static function hook_manage_posts_custom_column($column_name, $id) { if ($column_name === 'td_post_views') { echo self::get_page_views(get_the_ID()); } } static function hook_wp_admin() { add_filter('manage_posts_columns', array(__CLASS__, 'hook_manage_posts_columns')); add_action('manage_posts_custom_column', array(__CLASS__, 'hook_manage_posts_custom_column'), 5, 2); } } td_page_views::hook_wp_admin(); //do the hook shake