WP Tab Widget - Version 1.2.6

Version Description

  • Updated view counter function
Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Tab Widget
Version 1.2.6
Comparing to
See all releases

Code changes from version 1.2.5 to 1.2.6

Files changed (2) hide show
  1. readme.txt +6 -3
  2. wp-tab-widget.php +13 -18
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mythemeshop
3
  Creator's website link: http://mythemeshop.com/
4
  Tags: tabs, tab widget, recent posts tab, tabs widget, ajax tabs, ajax widget.
5
  Requires at least: 3.0.1
6
- Tested up to: 4.7
7
- Stable tag: 1.2.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -87,6 +87,9 @@ Please disable all plugins and check if shortcode plugin is working properly. Th
87
 
88
  == Changelog ==
89
 
 
 
 
90
  = 1.2.5 =
91
  * Added missing Pro version image
92
 
@@ -117,4 +120,4 @@ Please disable all plugins and check if shortcode plugin is working properly. Th
117
  * Performance improvement.
118
 
119
  = 1.0 =
120
- * Official plugin release.
3
  Creator's website link: http://mythemeshop.com/
4
  Tags: tabs, tab widget, recent posts tab, tabs widget, ajax tabs, ajax widget.
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.7.2
7
+ Stable tag: 1.2.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
87
 
88
  == Changelog ==
89
 
90
+ = 1.2.6 =
91
+ * Updated view counter function
92
+
93
  = 1.2.5 =
94
  * Added missing Pro version image
95
 
120
  * Performance improvement.
121
 
122
  = 1.0 =
123
+ * Official plugin release.
wp-tab-widget.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Tab Widget
4
  Plugin URI: http://mythemeshop.com/plugins/wp-tab-widget/
5
  Description: WP Tab Widget is the AJAXified plugin which loads content by demand, and thus it makes the plugin incredibly lightweight.
6
  Author: MyThemeShop
7
- Version: 1.2.5
8
  Author URI: http://mythemeshop.com/
9
  */
10
  if ( !class_exists('wpt_widget') ) {
@@ -606,33 +606,28 @@ function wpt_view_count_js( $content ) {
606
  $exclude_admins = apply_filters( 'mts_view_count_exclude_admins', false ); // pass in true or a user capaibility
607
  if ($exclude_admins === true) $exclude_admins = 'edit_posts';
608
  if ($exclude_admins && current_user_can( $exclude_admins )) return $content; // do not count post views here
 
609
 
610
- if (is_single()) {
611
- if ( ! has_filter('the_content', 'mts_view_count_js') && $use_ajax) { // prevent additional ajax call if theme has view counter already
612
- // enqueue jquery
613
- wp_enqueue_script( 'jquery' );
614
-
615
- $url = admin_url( 'admin-ajax.php' );
616
- $content .= "
617
  <script type=\"text/javascript\">
618
  jQuery(document).ready(function($) {
619
  $.post('{$url}', {action: 'wpt_view_count', id: '{$id}'});
620
  });
621
  </script>";
622
-
623
- }
 
624
 
625
- // if there's no general filter set and ajax is OFF
626
- if (! has_filter('the_content', 'mts_view_count_js') && ! $use_ajax) {
627
- wpt_update_view_count($id);
628
- }
629
- }
630
 
631
  return $content;
632
  }
633
 
634
-
635
-
636
  function ajax_wpt_view_count() {
637
  // do count
638
  $post_id = $_POST['id'];
@@ -701,4 +696,4 @@ function wp_tab_widget_notice_ignore() {
701
  add_user_meta($user_id, 'wp_tab_widget_ignore_notice', 'true', true);
702
  }
703
  }
704
- ?>
4
  Plugin URI: http://mythemeshop.com/plugins/wp-tab-widget/
5
  Description: WP Tab Widget is the AJAXified plugin which loads content by demand, and thus it makes the plugin incredibly lightweight.
6
  Author: MyThemeShop
7
+ Version: 1.2.6
8
  Author URI: http://mythemeshop.com/
9
  */
10
  if ( !class_exists('wpt_widget') ) {
606
  $exclude_admins = apply_filters( 'mts_view_count_exclude_admins', false ); // pass in true or a user capaibility
607
  if ($exclude_admins === true) $exclude_admins = 'edit_posts';
608
  if ($exclude_admins && current_user_can( $exclude_admins )) return $content; // do not count post views here
609
+ if (!is_single()) return $content; // Only on single posts
610
 
611
+ if ($use_ajax) { // prevent additional ajax call if theme has view counter already
612
+ // enqueue jquery
613
+ wp_enqueue_script( 'jquery' );
614
+
615
+ $url = admin_url( 'admin-ajax.php' );
616
+ $content .= "
 
617
  <script type=\"text/javascript\">
618
  jQuery(document).ready(function($) {
619
  $.post('{$url}', {action: 'wpt_view_count', id: '{$id}'});
620
  });
621
  </script>";
622
+ } else {
623
+ wpt_update_view_count($id);
624
+ }
625
 
626
+ remove_filter('the_content', 'wpt_view_count_js');
 
 
 
 
627
 
628
  return $content;
629
  }
630
 
 
 
631
  function ajax_wpt_view_count() {
632
  // do count
633
  $post_id = $_POST['id'];
696
  add_user_meta($user_id, 'wp_tab_widget_ignore_notice', 'true', true);
697
  }
698
  }
699
+ ?>