Version Description
- Fix: Most viewed posts widget broken
Download this release
Release Info
Developer | dfactory |
Plugin | Post Views Counter |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- includes/functions.php +1 -1
- includes/query.php +7 -4
- post-views-counter.php +3 -3
- readme.txt +6 -4
includes/functions.php
CHANGED
@@ -106,7 +106,7 @@ if ( ! function_exists( 'pvc_get_most_viewed_posts' ) ) {
|
|
106 |
// force to get all fields
|
107 |
$args['fields'] = '';
|
108 |
|
109 |
-
return get_posts( $args );
|
110 |
}
|
111 |
|
112 |
}
|
106 |
// force to get all fields
|
107 |
$args['fields'] = '';
|
108 |
|
109 |
+
return apply_filters( 'pvc_get_most_viewed_posts', get_posts( $args ), $args );
|
110 |
}
|
111 |
|
112 |
}
|
includes/query.php
CHANGED
@@ -97,11 +97,14 @@ class Post_Views_Counter_Query {
|
|
97 |
* @return string
|
98 |
*/
|
99 |
public function posts_fields( $fields, $query ) {
|
100 |
-
// is it sorted by post views?
|
101 |
-
if ( ( isset( $query->order_by_post_views ) && $query->order_by_post_views ) || apply_filters( 'pvc_extend_post_object', false, $query ) === true ) {
|
102 |
-
global $wpdb;
|
103 |
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
|
107 |
return $fields;
|
97 |
* @return string
|
98 |
*/
|
99 |
public function posts_fields( $fields, $query ) {
|
|
|
|
|
|
|
100 |
|
101 |
+
if ( isset( $query->query['fields'] ) && ( $query->query['fields'] === '' || $query->query['fields'] === 'all' ) ) {
|
102 |
+
// is it sorted by post views?
|
103 |
+
if ( ( isset( $query->order_by_post_views ) && $query->order_by_post_views ) || apply_filters( 'pvc_extend_post_object', false, $query ) === true ) {
|
104 |
+
global $wpdb;
|
105 |
+
|
106 |
+
$fields = $fields . ', IFNULL( pvc.count, 0 ) AS post_views';
|
107 |
+
}
|
108 |
}
|
109 |
|
110 |
return $fields;
|
post-views-counter.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Post Views Counter
|
4 |
Description: Forget WP-PostViews. Display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
|
5 |
-
Version: 1.1.
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
|
@@ -42,7 +42,7 @@ include_once( POST_VIEWS_COUNTER_PATH . 'includes/widgets.php' );
|
|
42 |
* Post Views Counter class
|
43 |
*
|
44 |
* @class Post_Views_Counter
|
45 |
-
* @version 1.1.
|
46 |
*/
|
47 |
class Post_Views_Counter {
|
48 |
|
@@ -91,7 +91,7 @@ class Post_Views_Counter {
|
|
91 |
'link_to_post' => true,
|
92 |
'icon_class' => 'dashicons-chart-bar'
|
93 |
),
|
94 |
-
'version' => '1.1.
|
95 |
);
|
96 |
|
97 |
public static function instance() {
|
2 |
/*
|
3 |
Plugin Name: Post Views Counter
|
4 |
Description: Forget WP-PostViews. Display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
|
5 |
+
Version: 1.1.2
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
|
42 |
* Post Views Counter class
|
43 |
*
|
44 |
* @class Post_Views_Counter
|
45 |
+
* @version 1.1.2
|
46 |
*/
|
47 |
class Post_Views_Counter {
|
48 |
|
91 |
'link_to_post' => true,
|
92 |
'icon_class' => 'dashicons-chart-bar'
|
93 |
),
|
94 |
+
'version' => '1.1.2'
|
95 |
);
|
96 |
|
97 |
public static function instance() {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.dfactory.eu/
|
|
4 |
Tags: counter, hits, postviews, post views, views, count
|
5 |
Requires at least: 4.0.0
|
6 |
Tested up to: 4.3.1
|
7 |
-
Stable tag: 1.1.
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
@@ -67,6 +67,9 @@ No questions yet.
|
|
67 |
|
68 |
== Changelog ==
|
69 |
|
|
|
|
|
|
|
70 |
= 1.1.1 =
|
71 |
* Tweak: Enable edit views on new post.
|
72 |
* Tweak: Extend WP_Query post data with post_views
|
@@ -118,6 +121,5 @@ Initial release
|
|
118 |
|
119 |
== Upgrade Notice ==
|
120 |
|
121 |
-
= 1.1.
|
122 |
-
*
|
123 |
-
* Tweak: Extend WP_Query post data with post_views
|
4 |
Tags: counter, hits, postviews, post views, views, count
|
5 |
Requires at least: 4.0.0
|
6 |
Tested up to: 4.3.1
|
7 |
+
Stable tag: 1.1.2
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 1.1.2 =
|
71 |
+
* Fix: Most viewed posts widget broken
|
72 |
+
|
73 |
= 1.1.1 =
|
74 |
* Tweak: Enable edit views on new post.
|
75 |
* Tweak: Extend WP_Query post data with post_views
|
121 |
|
122 |
== Upgrade Notice ==
|
123 |
|
124 |
+
= 1.1.2 =
|
125 |
+
* Fix: Most viewed posts widget broken
|
|