Top 10 – Popular posts plugin for WordPress - Version 2.2.3

Version Description

  • Bug fixes:
    • Shortcode with "exclude_categories" argument works again
Download this release

Release Info

Developer Ajay
Plugin Icon 128x128 Top 10 – Popular posts plugin for WordPress
Version 2.2.3
Comparing to
See all releases

Code changes from version 2.2.2 to 2.2.3

Files changed (3) hide show
  1. includes/media.php +10 -0
  2. readme.txt +9 -3
  3. top-10.php +20 -1
includes/media.php CHANGED
@@ -80,6 +80,16 @@ function tptn_get_the_post_thumbnail( $args = array() ) {
80
  $postid = $result->ID;
81
  $post_title = $result->post_title;
82
 
 
 
 
 
 
 
 
 
 
 
83
  $output = '';
84
  $postimage = '';
85
  $pick = '';
80
  $postid = $result->ID;
81
  $post_title = $result->post_title;
82
 
83
+ /**
84
+ * Filters the title and alt message for thumbnails.
85
+ *
86
+ * @since 2.3.0
87
+ *
88
+ * @param string $post_title Post tile used as thumbnail alt and title
89
+ * @param object $result Post Object
90
+ */
91
+ $post_title = apply_filters( 'tptn_thumb_title', $post_title, $result );
92
+
93
  $output = '';
94
  $postimage = '';
95
  $pick = '';
readme.txt CHANGED
@@ -1,4 +1,4 @@
1
- === Top 10 - Popular posts plugin for WordPress ===
2
  Tags: popular posts, top 10, counter, top posts, daily popular, page views, statistics
3
  Contributors: Ajay
4
  Donate link: https://ajaydsouza.com/donate/
@@ -63,7 +63,8 @@ So, if you've got some cool feature that you'd like to implement into the plugin
63
  7. Top 10 widget options
64
  8. Top 10 Meta box on the Edit Post screen
65
  9. WordPress Multisite: Import Top 10 v1.x counts
66
- 10. Reset count and tools
 
67
 
68
  == Installation ==
69
 
@@ -171,6 +172,11 @@ add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sorta
171
 
172
  == Changelog ==
173
 
 
 
 
 
 
174
  = 2.2.2 =
175
 
176
  * Bug fixes:
@@ -270,7 +276,7 @@ For previous changelog entries, please refer to the separate changelog.txt file
270
 
271
  == Upgrade Notice ==
272
 
273
- = 2.2.1 =
274
  * New features. Deprecated functions. Upgrade highly recommended. Please do verify your settings after the upgrade.
275
  Check the Changelog for more details
276
 
1
+ === Top 10 - Popular posts plugin for WordPress ===
2
  Tags: popular posts, top 10, counter, top posts, daily popular, page views, statistics
3
  Contributors: Ajay
4
  Donate link: https://ajaydsouza.com/donate/
63
  7. Top 10 widget options
64
  8. Top 10 Meta box on the Edit Post screen
65
  9. WordPress Multisite: Import Top 10 v1.x counts
66
+ 10. Reset count and tools
67
+ 11. Top 10 - Popular posts view in Admin
68
 
69
  == Installation ==
70
 
172
 
173
  == Changelog ==
174
 
175
+ = 2.2.3 =
176
+
177
+ * Bug fixes:
178
+ * Shortcode with "exclude_categories" argument works again
179
+
180
  = 2.2.2 =
181
 
182
  * Bug fixes:
276
 
277
  == Upgrade Notice ==
278
 
279
+ = 2.2.3 =
280
  * New features. Deprecated functions. Upgrade highly recommended. Please do verify your settings after the upgrade.
281
  Check the Changelog for more details
282
 
top-10.php CHANGED
@@ -14,7 +14,7 @@
14
  * Plugin Name: Top 10
15
  * Plugin URI: https://webberzone.com/plugins/top-10/
16
  * Description: Count daily and total visits per post and display the most popular posts based on the number of views
17
- * Version: 2.2.2
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * Text Domain: tptn
@@ -94,6 +94,12 @@ add_action( 'init', 'tptn_lang_init' );
94
  function tptn_pop_posts( $args ) {
95
  global $wpdb, $id, $tptn_settings;
96
 
 
 
 
 
 
 
97
  $defaults = array(
98
  'daily' => FALSE,
99
  'is_widget' => FALSE,
@@ -209,6 +215,19 @@ function tptn_pop_posts( $args ) {
209
 
210
  $result = get_post( $postid ); // Let's get the Post using the ID
211
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  $output .= tptn_before_list_item( $args, $result );
213
 
214
  $output .= tptn_list_link( $args, $result );
14
  * Plugin Name: Top 10
15
  * Plugin URI: https://webberzone.com/plugins/top-10/
16
  * Description: Count daily and total visits per post and display the most popular posts based on the number of views
17
+ * Version: 2.2.3
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * Text Domain: tptn
94
  function tptn_pop_posts( $args ) {
95
  global $wpdb, $id, $tptn_settings;
96
 
97
+ // if set, save $exclude_categories
98
+ if ( isset( $args['exclude_categories'] ) && '' != $args['exclude_categories'] ) {
99
+ $exclude_categories = explode( ",", $args['exclude_categories'] );
100
+ $args['strict_limit'] = FALSE;
101
+ }
102
+
103
  $defaults = array(
104
  'daily' => FALSE,
105
  'is_widget' => FALSE,
215
 
216
  $result = get_post( $postid ); // Let's get the Post using the ID
217
 
218
+ // Process the category exclusion if passed in the shortcode
219
+ if ( isset( $exclude_categories ) ) {
220
+
221
+ $categorys = get_the_category( $result->ID ); //Fetch categories of the plugin
222
+
223
+ $p_in_c = false; // Variable to check if post exists in a particular category
224
+ foreach ( $categorys as $cat ) { // Loop to check if post exists in excluded category
225
+ $p_in_c = ( in_array( $cat->cat_ID, $exclude_categories ) ) ? true : false;
226
+ if ( $p_in_c ) break; // Skip loop execution and go to the next step
227
+ }
228
+ if ( $p_in_c ) continue; // Skip loop execution and go to the next step
229
+ }
230
+
231
  $output .= tptn_before_list_item( $args, $result );
232
 
233
  $output .= tptn_list_link( $args, $result );