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; }
/** * 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; }