Content Views – Post Grid & List for WordPress - Version 1.1.2

Version Description

  • Fix offset bug
Download this release

Release Info

Developer PT Guy
Plugin Icon 128x128 Content Views – Post Grid & List for WordPress
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

Files changed (3) hide show
  1. README.txt +7 -1
  2. content-views.php +2 -2
  3. includes/functions.php +13 -10
README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: post, posts, page, pages, query, queries, search, display, show, shortcode, thumbnail, title, content, excerpt, meta, date, author, term, taxonomy, pagination, grid, scrollable, collapsible, list, slide, layout, ui
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
- Stable tag: 1.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -124,6 +124,9 @@ You can create Unlimited Views, in Unlimited websites
124
 
125
  == Changelog ==
126
 
 
 
 
127
  = 1.1.1 =
128
  * Fix pagination bug
129
 
@@ -149,6 +152,9 @@ You can create Unlimited Views, in Unlimited websites
149
 
150
  == Upgrade Notice ==
151
 
 
 
 
152
  = 1.1.1 =
153
  Fix pagination bug
154
 
4
  Tags: post, posts, page, pages, query, queries, search, display, show, shortcode, thumbnail, title, content, excerpt, meta, date, author, term, taxonomy, pagination, grid, scrollable, collapsible, list, slide, layout, ui
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
+ Stable tag: 1.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
124
 
125
  == Changelog ==
126
 
127
+ = 1.1.2 =
128
+ * Fix offset bug
129
+
130
  = 1.1.1 =
131
  * Fix pagination bug
132
 
152
 
153
  == Upgrade Notice ==
154
 
155
+ = 1.1.2 =
156
+ Fix offset bug
157
+
158
  = 1.1.1 =
159
  Fix pagination bug
160
 
content-views.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
- * Version: 1.1.1
14
  * Author: Palace Of Themes
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views
@@ -27,7 +27,7 @@ if ( ! defined( 'WPINC' ) ) {
27
  /*
28
  * Define Constant
29
  */
30
- define( 'PT_CV_VERSION', '1.1.1' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  include_once( plugin_dir_path( __FILE__ ) . 'includes/defines.php' );
33
 
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
+ * Version: 1.1.2
14
  * Author: Palace Of Themes
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views
27
  /*
28
  * Define Constant
29
  */
30
+ define( 'PT_CV_VERSION', '1.1.2' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  include_once( plugin_dir_path( __FILE__ ) . 'includes/defines.php' );
33
 
includes/functions.php CHANGED
@@ -520,11 +520,15 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
520
 
521
  // Append Pagination HTML if this is first page, or not Ajax calling
522
  if ( $args['posts_per_page'] > 0 && $current_page === 1 ) {
 
 
 
523
  // Total number of items
524
- $total_items = ( $args['limit'] > 0 && $pt_query->found_posts > $args['limit'] ) ? $args['limit'] : $pt_query->found_posts;
525
 
526
  // Total number of pages
527
  $max_num_pages = ceil( $total_items / $args['posts_per_page'] );
 
528
  $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, $dargs, $id );
529
  }
530
 
@@ -794,6 +798,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
794
  $limit = trim( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'limit', $settings_ ) );
795
  $limit = ( empty( $limit ) || $limit === '-1' ) ? 10000000 : (int) $limit;
796
  $args['limit'] = $args['posts_per_page'] = $limit;
 
797
 
798
  // Get pagination enable/disable
799
  $pagination = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'enable-pagination', $settings_ );
@@ -819,18 +824,16 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
819
  // Get offset
820
  if ( isset( $pargs['page'] ) ) {
821
  $offset = $posts_per_page * ( (int) $pargs['page'] - 1 );
822
-
823
- // Reaching out of limit
824
- if ( $offset > $limit ) {
825
- return '';
826
- }
827
-
828
- // Set 'offset' parameter
829
- $args['offset'] = $offset;
830
  }
831
  }
832
 
833
- $args = apply_filters( PT_CV_PREFIX_ . 'settings_args_offset', $args, $pagination, $pargs, $settings_, $limit );
 
 
 
 
 
 
834
  }
835
 
836
  /**
520
 
521
  // Append Pagination HTML if this is first page, or not Ajax calling
522
  if ( $args['posts_per_page'] > 0 && $current_page === 1 ) {
523
+ // Total post founds
524
+ $found_posts = apply_filters( PT_CV_PREFIX_ . 'found_posts', $pt_query->found_posts, $settings_ );
525
+
526
  // Total number of items
527
+ $total_items = ( $args['limit'] > 0 && $found_posts > $args['limit'] ) ? $args['limit'] : $found_posts;
528
 
529
  // Total number of pages
530
  $max_num_pages = ceil( $total_items / $args['posts_per_page'] );
531
+
532
  $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, $dargs, $id );
533
  }
534
 
798
  $limit = trim( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'limit', $settings_ ) );
799
  $limit = ( empty( $limit ) || $limit === '-1' ) ? 10000000 : (int) $limit;
800
  $args['limit'] = $args['posts_per_page'] = $limit;
801
+ $offset = 0;
802
 
803
  // Get pagination enable/disable
804
  $pagination = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'enable-pagination', $settings_ );
824
  // Get offset
825
  if ( isset( $pargs['page'] ) ) {
826
  $offset = $posts_per_page * ( (int) $pargs['page'] - 1 );
 
 
 
 
 
 
 
 
827
  }
828
  }
829
 
830
+ $offset = apply_filters( PT_CV_PREFIX_ . 'settings_args_offset', $offset, $settings_ );
831
+
832
+ // Not reaching out of limit
833
+ if ( $offset < $limit ) {
834
+ // Set 'offset' parameter
835
+ $args['offset'] = $offset;
836
+ }
837
  }
838
 
839
  /**