WP Tab Widget - Version 1.2.7

Version Description

(Feb 03, 2017) = * Added new wpt_sampling_rate filter. See the FAQ section on how this works.

Download this release

Release Info

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

Code changes from version 1.2.6 to 1.2.7

Files changed (2) hide show
  1. readme.txt +38 -21
  2. wp-tab-widget.php +6 -3
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  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.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
 
@@ -59,7 +59,7 @@ Support link:<br>
59
 
60
  MyThemeShop is a premium WordPress theme provider and we develop premium plugins in our free time and distribute them for free to give back to the community. Though we take a lot of care while developing anything, we might have missed something useful/important. Please help us make it better by submitting the bug/suggestions/feedback on GitHub.
61
 
62
- GitHub link: <a href="https://github.com/MyThemeShop/WP-Tab-Widget-by-MyThemeShop">https://github.com/MyThemeShop/WP-Tab-Widget-by-MyThemeShop</a>
63
 
64
  = Feedback =
65
  If you like this plugin, then please leave us a good rating and review.<br> Consider following us on <a rel="author" href="https://plus.google.com/+Mythemeshop/">Google+</a>, <a href="https://twitter.com/MyThemeShopTeam">Twitter</a>, and <a href="https://www.facebook.com/MyThemeShop">Facebook</a>
@@ -80,6 +80,20 @@ This section describes how to install the plugin and get it working.
80
 
81
  Please disable all plugins and check if shortcode plugin is working properly. Then you can enable all plugins one by one to find out which plugin is conflicting with plugin.
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  == Screenshots ==
84
 
85
  1. WP Tab Widget Settings
@@ -87,37 +101,40 @@ Please disable all plugins and check if shortcode plugin is working properly. Th
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
 
96
- = 1.2.4 =
97
- * Replaced "comm" CSS class with "comments-number" on comment count in Recent tab
98
- * Added "Show Some Love" option
99
 
100
- = 1.2.3 =
101
- * Fixed issue where tab content couldn't be loaded on servers with non UTF8 character encoding
102
  * List only comments from default comment type in Comments tab
103
  * Prevent conflict with Pro version
104
  * Added Notification & Banner for Pro Version
105
 
106
- = 1.2.2 =
107
  * Changed text domain to make plugin compatible with WordPress Language Packs
108
 
109
- = 1.2.1 =
110
  * Switched to PHP 5 style constructor method for the widget class
111
 
112
- = 1.2 =
113
  * Added Title Length option
114
  * Fixed post view count compatibility with themes
115
 
116
- = 1.1 =
117
- * Popular posts will be decided by number of views.
118
- * Added loading effect.
119
- * Fixed small bugs.
120
- * Performance improvement.
121
 
122
- = 1.0 =
123
- * Official plugin release.
2
  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: 4.0
6
+ Tested up to: 4.9.1
7
+ Stable tag: 1.2.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
59
 
60
  MyThemeShop is a premium WordPress theme provider and we develop premium plugins in our free time and distribute them for free to give back to the community. Though we take a lot of care while developing anything, we might have missed something useful/important. Please help us make it better by submitting the bug/suggestions/feedback on GitHub.
61
 
62
+ GitHub link: <a href="https://github.com/MyThemeShopTeam/WP-Tab-Widget">https://github.com/MyThemeShopTeam/WP-Tab-Widget</a>
63
 
64
  = Feedback =
65
  If you like this plugin, then please leave us a good rating and review.<br> Consider following us on <a rel="author" href="https://plus.google.com/+Mythemeshop/">Google+</a>, <a href="https://twitter.com/MyThemeShopTeam">Twitter</a>, and <a href="https://www.facebook.com/MyThemeShop">Facebook</a>
80
 
81
  Please disable all plugins and check if shortcode plugin is working properly. Then you can enable all plugins one by one to find out which plugin is conflicting with plugin.
82
 
83
+ = Plugins is consuming too much resources =
84
+
85
+ The pageview is incremented on the database everytime a user visits a page but this can start getting quite expensive on high-traffic websites. We've added the filter `wpt_sampling_rate` which you can use to lower the sampling rate from the default <strong>100%</strong>. Note that setting this value too low will result to innacurate pageviews.
86
+
87
+ `
88
+ <?php
89
+
90
+ function wpt_my_sampling_rate( $rate ) {
91
+ // Reduce the percentage of pageviews recorded to 80%.
92
+ return 80;
93
+ }
94
+ add_filter( 'wpt_sampling_rate', 'wpt_my_sampling_rate' );
95
+ `
96
+
97
  == Screenshots ==
98
 
99
  1. WP Tab Widget Settings
101
 
102
  == Changelog ==
103
 
104
+ = 1.2.7 (Feb 03, 2017) =
105
+ * Added new wpt_sampling_rate filter. See the FAQ section on how this works.
106
+
107
+ = 1.2.6 (Jan 28, 2017) =
108
  * Updated view counter function
109
 
110
+ = 1.2.5 (Apr 06, 2016) =
111
  * Added missing Pro version image
112
 
113
+ = 1.2.4 (Mar 27, 2016) =
114
+ * Replaced comm CSS class with comments-number on comment count in Recent tab
115
+ * Added Show Some Love option
116
 
117
+ = 1.2.3 (Mar 22, 2016) =
118
+ * Fixed issue where tab content couldnt be loaded on servers with non UTF8 character encoding
119
  * List only comments from default comment type in Comments tab
120
  * Prevent conflict with Pro version
121
  * Added Notification & Banner for Pro Version
122
 
123
+ = 1.2.2 (Aug 21, 2015) =
124
  * Changed text domain to make plugin compatible with WordPress Language Packs
125
 
126
+ = 1.2.1 (Aug 19, 2015) =
127
  * Switched to PHP 5 style constructor method for the widget class
128
 
129
+ = 1.2 (Oct 15, 2014) =
130
  * Added Title Length option
131
  * Fixed post view count compatibility with themes
132
 
133
+ = 1.1 (Oct 1, 2014) =
134
+ * Popular posts will be decided by number of views
135
+ * Added loading effect
136
+ * Fixed small bugs
137
+ * Performance improvement
138
 
139
+ = 1.0 (Mar 24, 2014) =
140
+ * Plugin released
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.6
8
  Author URI: http://mythemeshop.com/
9
  */
10
  if ( !class_exists('wpt_widget') ) {
@@ -634,8 +634,11 @@ function ajax_wpt_view_count() {
634
  wpt_update_view_count( $post_id );
635
  }
636
  function wpt_update_view_count( $post_id ) {
637
- $count = get_post_meta( $post_id, '_wpt_view_count', true );
638
- update_post_meta( $post_id, '_wpt_view_count', $count + 1 );
 
 
 
639
  }
640
 
641
  // Add meta for all existing posts that don't have it
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.7
8
  Author URI: http://mythemeshop.com/
9
  */
10
  if ( !class_exists('wpt_widget') ) {
634
  wpt_update_view_count( $post_id );
635
  }
636
  function wpt_update_view_count( $post_id ) {
637
+ $sample_rate = intval( apply_filters( 'wpt_sampling_rate', 100 ) ) / 100;
638
+ if ( ( mt_rand() / mt_getrandmax() ) <= $sample_rate ) {
639
+ $count = get_post_meta( $post_id, '_wpt_view_count', true );
640
+ update_post_meta( $post_id, '_wpt_view_count', $count + 1 );
641
+ }
642
  }
643
 
644
  // Add meta for all existing posts that don't have it