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

Version Description

  • Bug fixed: Duplicate callback called after pagination finished
  • Tested in WordPress 4.2.4
Download this release

Release Info

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

Code changes from version 1.6.5 to 1.6.5.1

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: pt-guy
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
4
  Tags: post, posts, page, pages, query, queries, search, display, show, grid, column, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
5
  Requires at least: 3.3
6
- Tested up to: 4.2.3
7
- Stable tag: 1.6.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -165,6 +165,10 @@ function my_move_bootstrap( $args ) {
165
 
166
  == Changelog ==
167
 
 
 
 
 
168
  = 1.6.5 =
169
  * Update: Big update to improve page performance
170
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
4
  Tags: post, posts, page, pages, query, queries, search, display, show, grid, column, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
5
  Requires at least: 3.3
6
+ Tested up to: 4.2.4
7
+ Stable tag: 1.6.5.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
165
 
166
  == Changelog ==
167
 
168
+ = 1.6.5.1 =
169
+ * Bug fixed: Duplicate callback called after pagination finished
170
+ * Tested in WordPress 4.2.4
171
+
172
  = 1.6.5 =
173
  * Update: Big update to improve page performance
174
 
admin/includes/plugin.php CHANGED
@@ -167,7 +167,7 @@ if ( !class_exists( 'PT_CV_Plugin' ) ) {
167
  $field_name = 'unload_bootstrap';
168
 
169
  self::_field_print(
170
- $field_name, 'checkbox', __( "Don't load <b>Bootstrap 3</b> style & script (in frontend of website)", PT_CV_DOMAIN ), __( 'Only check this option if Bootstrap has been loaded by active theme or other plugins', PT_CV_DOMAIN )
171
  );
172
  }
173
 
167
  $field_name = 'unload_bootstrap';
168
 
169
  self::_field_print(
170
+ $field_name, 'checkbox', __( "Don't load <b>Bootstrap 3</b> style & script (in frontend of website)", PT_CV_DOMAIN ), __( 'Only tick this option if Bootstrap has been loaded by active theme or other plugins', PT_CV_DOMAIN )
171
  );
172
  }
173
 
admin/views/view.php CHANGED
@@ -318,7 +318,7 @@ PT_CV_Functions::view_submit();
318
  'options' => PT_CV_Values::taxonomy_list(),
319
  'std' => '',
320
  'class' => 'taxonomy-item',
321
- 'desc' => __( 'Check checkbox of taxonomies to filter posts by their terms', PT_CV_DOMAIN ),
322
  ),
323
  ),
324
  ),
318
  'options' => PT_CV_Values::taxonomy_list(),
319
  'std' => '',
320
  'class' => 'taxonomy-item',
321
+ 'desc' => __( 'Tick checkbox of taxonomies to filter posts by their terms', PT_CV_DOMAIN ),
322
  ),
323
  ),
324
  ),
content-views.php CHANGED
@@ -11,7 +11,7 @@
11
  * Plugin Name: Content Views
12
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
13
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
14
- * Version: 1.6.5
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views
@@ -27,7 +27,7 @@ if ( !defined( 'WPINC' ) ) {
27
  /*
28
  * Define Constant
29
  */
30
- define( 'PT_CV_VERSION', '1.6.5' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
11
  * Plugin Name: Content Views
12
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
13
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
14
+ * Version: 1.6.5.1
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views
27
  /*
28
  * Define Constant
29
  */
30
+ define( 'PT_CV_VERSION', '1.6.5.1' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
includes/functions.php CHANGED
@@ -684,6 +684,9 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
684
  );
685
  }
686
 
 
 
 
687
  // Pagination settings
688
  PT_CV_Functions::view_get_pagination_settings( $dargs, $args, $pargs );
689
 
@@ -776,8 +779,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
776
  global $post;
777
 
778
  // Output HTML for this item
779
- $post_id = apply_filters( PT_CV_PREFIX_ . 'show_this_post', $post->ID );
780
- if ( $post_id ) {
781
  $content_items[ $post->ID ] = PT_CV_Html::view_type_output( $view_type, $post );
782
  }
783
  }
684
  );
685
  }
686
 
687
+ // Unlock Session
688
+ session_write_close();
689
+
690
  // Pagination settings
691
  PT_CV_Functions::view_get_pagination_settings( $dargs, $args, $pargs );
692
 
779
  global $post;
780
 
781
  // Output HTML for this item
782
+ $_post = apply_filters( PT_CV_PREFIX_ . 'show_this_post', $post );
783
+ if ( $_post ) {
784
  $content_items[ $post->ID ] = PT_CV_Html::view_type_output( $view_type, $post );
785
  }
786
  }
includes/html.php CHANGED
@@ -356,9 +356,6 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
356
  $output = $html;
357
  }
358
 
359
- // Unlock Session
360
- session_write_close();
361
-
362
  return balanceTags( $before_output ) . balanceTags( $output );
363
  }
364
 
@@ -623,7 +620,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
623
  if ( $load_thumbnail ) {
624
  $thumbnail_size = count( $dimensions ) > 1 ? $dimensions : $dimensions[ 0 ];
625
  $html = wp_get_attachment_image( (int) $thumbnail_id, $thumbnail_size, false, $gargs );
626
- $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_image', $html, $post_id, $dimensions, $fargs );
627
  } else {
628
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_not_found', $html, $post, $dimensions, $gargs );
629
  }
@@ -895,6 +892,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
895
  PT_CV_Asset::localize_script(
896
  'public', PT_CV_PREFIX_UPPER . 'PUBLIC', array(
897
  '_prefix' => PT_CV_PREFIX,
 
898
  '_nonce' => wp_create_nonce( PT_CV_PREFIX_ . 'ajax_nonce' ),
899
  'is_admin' => is_admin(),
900
  'is_mobile' => wp_is_mobile(),
356
  $output = $html;
357
  }
358
 
 
 
 
359
  return balanceTags( $before_output ) . balanceTags( $output );
360
  }
361
 
620
  if ( $load_thumbnail ) {
621
  $thumbnail_size = count( $dimensions ) > 1 ? $dimensions : $dimensions[ 0 ];
622
  $html = wp_get_attachment_image( (int) $thumbnail_id, $thumbnail_size, false, $gargs );
623
+ $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_image', $html, $post, $dimensions, $fargs );
624
  } else {
625
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_not_found', $html, $post, $dimensions, $gargs );
626
  }
892
  PT_CV_Asset::localize_script(
893
  'public', PT_CV_PREFIX_UPPER . 'PUBLIC', array(
894
  '_prefix' => PT_CV_PREFIX,
895
+ 'page_to_show' => apply_filters( PT_CV_PREFIX_ . 'pages_to_show', 5 ),
896
  '_nonce' => wp_create_nonce( PT_CV_PREFIX_ . 'ajax_nonce' ),
897
  'is_admin' => is_admin(),
898
  'is_mobile' => wp_is_mobile(),
includes/settings.php CHANGED
@@ -382,7 +382,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
382
  'name' => $prefix . 'excerpt-allow_html',
383
  'options' => PT_CV_Values::yes_no( 'yes', __( 'Allow HTML tags (a, br, strong, em, strike, i, ul, ol, li) in excerpt', PT_CV_DOMAIN ) ),
384
  'std' => '',
385
- 'desc' => __( 'This option can cause broken HTML output. Please be careful when check it', PT_CV_DOMAIN ),
386
  ),
387
  ),
388
  ),
382
  'name' => $prefix . 'excerpt-allow_html',
383
  'options' => PT_CV_Values::yes_no( 'yes', __( 'Allow HTML tags (a, br, strong, em, strike, i, ul, ol, li) in excerpt', PT_CV_DOMAIN ) ),
384
  'std' => '',
385
+ 'desc' => __( 'This option can cause broken HTML output. Please be careful when tick it', PT_CV_DOMAIN ),
386
  ),
387
  ),
388
  ),
public/assets/js/public.js CHANGED
@@ -66,6 +66,7 @@
66
  bootstrapMajorVersion: 3,
67
  currentPage: current_page,
68
  totalPages: total_pages,
 
69
  shouldShowPage: function ( type, page, current ) {
70
  if ( total_pages && total_pages < 10 ) {
71
  switch ( type ) {
@@ -140,8 +141,9 @@
140
  * @returns void
141
  */
142
  _get_page: function ( session_id, selected_page, spinner, pages_holder, callback ) {
143
-
144
  var $self = this;
 
 
145
  // Show content of page if it existed
146
  var page_existed = $self._active_page( selected_page, pages_holder, callback );
147
  // If page is loaded, exit
@@ -176,6 +178,13 @@
176
 
177
  // Active current page
178
  $self._active_page( selected_page, pages_holder, callback );
 
 
 
 
 
 
 
179
  } );
180
  },
181
  /**
@@ -190,7 +199,6 @@
190
  var _prefix = PT_CV_PUBLIC._prefix;
191
  var page_existed = false;
192
  var page_selector = '#' + _prefix + 'page' + '-' + parseInt( selected_page );
193
-
194
  if ( pages_holder.children( page_selector ).length ) {
195
  page_existed = true;
196
 
@@ -206,13 +214,6 @@
206
  }, 1000 );
207
  }
208
 
209
- if ( callback && typeof callback === 'function' ) {
210
- callback();
211
- }
212
-
213
- // Trigger to make Pinterest layout works when do pagination
214
- $( 'body' ).trigger( _prefix + 'pagination-finished' );
215
-
216
  return page_existed;
217
  }
218
  };
66
  bootstrapMajorVersion: 3,
67
  currentPage: current_page,
68
  totalPages: total_pages,
69
+ numberOfPages: PT_CV_PUBLIC.page_to_show,
70
  shouldShowPage: function ( type, page, current ) {
71
  if ( total_pages && total_pages < 10 ) {
72
  switch ( type ) {
141
  * @returns void
142
  */
143
  _get_page: function ( session_id, selected_page, spinner, pages_holder, callback ) {
 
144
  var $self = this;
145
+ var _prefix = PT_CV_PUBLIC._prefix;
146
+
147
  // Show content of page if it existed
148
  var page_existed = $self._active_page( selected_page, pages_holder, callback );
149
  // If page is loaded, exit
178
 
179
  // Active current page
180
  $self._active_page( selected_page, pages_holder, callback );
181
+
182
+ if ( callback && typeof callback === 'function' ) {
183
+ callback();
184
+ }
185
+
186
+ // Trigger to make Pinterest layout works when do pagination
187
+ $( 'body' ).trigger( _prefix + 'pagination-finished' );
188
  } );
189
  },
190
  /**
199
  var _prefix = PT_CV_PUBLIC._prefix;
200
  var page_existed = false;
201
  var page_selector = '#' + _prefix + 'page' + '-' + parseInt( selected_page );
 
202
  if ( pages_holder.children( page_selector ).length ) {
203
  page_existed = true;
204
 
214
  }, 1000 );
215
  }
216
 
 
 
 
 
 
 
 
217
  return page_existed;
218
  }
219
  };