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

Version Description

  • Bug fixed: "undefined" Bootstrap stylesheet link
  • Update: Add some custom filters
Download this release

Release Info

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

Code changes from version 1.5.5 to 1.5.6

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, 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.1.1
7
- Stable tag: 1.5.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -136,7 +136,7 @@ You can create Unlimited Views, in Unlimited websites
136
  = How can I add View to homepage? =
137
 
138
  If you are using a static page as homepage, you should add View shortcode to editor of that page.
139
- If you are using a dynamic page (you created a custom site front page template, such as front-page.php), you should paste this code `<?php echo do_shortcode('[pt_view id="VIEW_ID"]'); ?>` to appropriate line in that file.
140
 
141
  = [BUG] When I use Cache plugin (W3TC, WP-Super-Cache...), the grid columns does not work. How to fix it? =
142
 
@@ -165,6 +165,10 @@ function my_move_bootstrap( $args ) {
165
 
166
  == Changelog ==
167
 
 
 
 
 
168
  = 1.5.5 =
169
  * Bug fixed: Multiple paginations on same page do not work
170
  * Bug fixed: Fix some UI bugs in Add/Edit View page
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.1.1
7
+ Stable tag: 1.5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
136
  = How can I add View to homepage? =
137
 
138
  If you are using a static page as homepage, you should add View shortcode to editor of that page.
139
+ If you are using a dynamic page (you created a front page template, such as front-page.php), you should paste this code `<?php echo do_shortcode('[pt_view id="VIEW_ID"]'); ?>` to appropriate line in that file.
140
 
141
  = [BUG] When I use Cache plugin (W3TC, WP-Super-Cache...), the grid columns does not work. How to fix it? =
142
 
165
 
166
  == Changelog ==
167
 
168
+ = 1.5.6 =
169
+ * Bug fixed: "undefined" Bootstrap stylesheet link
170
+ * Update: Add some custom filters
171
+
172
  = 1.5.5 =
173
  * Bug fixed: Multiple paginations on same page do not work
174
  * Bug fixed: Fix some UI bugs in Add/Edit View page
admin/views/view.php CHANGED
@@ -525,6 +525,8 @@ echo balanceTags( PT_Options_Framework::do_settings( $options, $settings ) );
525
  ),
526
  ),
527
 
 
 
528
  // Layout format of output item
529
  array(
530
  'label' => array(
525
  ),
526
  ),
527
 
528
+ apply_filters( PT_CV_PREFIX_ . 'responsive_settings', array() ),
529
+
530
  // Layout format of output item
531
  array(
532
  'label' => array(
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.5.5
14
  * Author: PT Guy
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.5.5' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
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.5.6
14
  * Author: PT Guy
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.5.6' );
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
@@ -604,18 +604,23 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
604
  // Get content type
605
  global $pt_content_type;
606
  $pt_content_type = $content_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $pt_view_settings );
 
607
 
608
  // Get view type
609
  global $pt_view_type;
610
  $pt_view_type = $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $pt_view_settings );
611
 
612
  // Store display settings
613
- global $dargs, $pt_query_args;
614
 
615
  $session_id = ( $pargs && isset( $pargs['session_id'] ) ) ? $pargs['session_id'] : 0;
616
 
617
  // If is pagination request
618
  if ( $session_id ) {
 
 
 
 
619
  $session_data = array_merge(
620
  array( '$args' => '', '$dargs' => '' ),
621
  ( false === ( $saved_settings = get_transient( PT_CV_PREFIX . 'view-data-' . $session_id ) ) ) ? array() : $saved_settings
@@ -624,7 +629,6 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
624
  $args = $session_data['$args'];
625
  $dargs = $session_data['$dargs'];
626
  } else {
627
- global $pt_view_sid;
628
  // If id is passed, assign it to session id, otherwise, generate random number
629
  $pt_view_sid = $session_id = $id ? $id : PT_CV_Functions::string_random();
630
 
@@ -929,6 +933,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
929
  'field' => 'slug',
930
  'terms' => (array) PT_CV_Functions::setting_value( PT_CV_PREFIX . $taxonomy . '-terms', $pt_view_settings ),
931
  'operator' => $operator,
 
932
  );
933
  }
934
  }
@@ -982,7 +987,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
982
  /**
983
  * Columns count & Rows count
984
  */
985
- $dargs['number-columns'] = PT_CV_Functions::setting_value( PT_CV_PREFIX . $view_type . '-' . 'number-columns', $pt_view_settings, 1 );
986
  $dargs['number-rows'] = PT_CV_Functions::setting_value( PT_CV_PREFIX . $view_type . '-' . 'number-rows', $pt_view_settings, 1 );
987
 
988
  /**
604
  // Get content type
605
  global $pt_content_type;
606
  $pt_content_type = $content_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $pt_view_settings );
607
+ $content_type = apply_filters( PT_CV_PREFIX_ . 'content_type', $content_type, $id );
608
 
609
  // Get view type
610
  global $pt_view_type;
611
  $pt_view_type = $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $pt_view_settings );
612
 
613
  // Store display settings
614
+ global $dargs, $pt_query_args, $pt_view_sid;
615
 
616
  $session_id = ( $pargs && isset( $pargs['session_id'] ) ) ? $pargs['session_id'] : 0;
617
 
618
  // If is pagination request
619
  if ( $session_id ) {
620
+ if ( empty( $pt_view_sid ) ) {
621
+ $pt_view_sid = $session_id;
622
+ }
623
+
624
  $session_data = array_merge(
625
  array( '$args' => '', '$dargs' => '' ),
626
  ( false === ( $saved_settings = get_transient( PT_CV_PREFIX . 'view-data-' . $session_id ) ) ) ? array() : $saved_settings
629
  $args = $session_data['$args'];
630
  $dargs = $session_data['$dargs'];
631
  } else {
 
632
  // If id is passed, assign it to session id, otherwise, generate random number
633
  $pt_view_sid = $session_id = $id ? $id : PT_CV_Functions::string_random();
634
 
933
  'field' => 'slug',
934
  'terms' => (array) PT_CV_Functions::setting_value( PT_CV_PREFIX . $taxonomy . '-terms', $pt_view_settings ),
935
  'operator' => $operator,
936
+ 'include_children' => apply_filters( PT_CV_PREFIX_ . 'include_children', true )
937
  );
938
  }
939
  }
987
  /**
988
  * Columns count & Rows count
989
  */
990
+ $dargs['number-columns'] = apply_filters( PT_CV_PREFIX_ . 'item_per_row', PT_CV_Functions::setting_value( PT_CV_PREFIX . $view_type . '-' . 'number-columns', $pt_view_settings, 1 ) );
991
  $dargs['number-rows'] = PT_CV_Functions::setting_value( PT_CV_PREFIX . $view_type . '-' . 'number-rows', $pt_view_settings, 1 );
992
 
993
  /**
includes/html.php CHANGED
@@ -197,6 +197,8 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
197
  $fields_html[$field_name] = self::field_item_html( $field_name, $post, $fargs );
198
  }
199
 
 
 
200
  // Get HTML content of view type, with specific style
201
  $file_path = $view_type_dir . '/' . 'html' . '/' . $style . '.' . 'php';
202
 
@@ -496,8 +498,9 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
496
 
497
  // Get excerpt
498
  if ( $length > 0 ) {
 
499
  // Extract excerpt from content
500
- $excerpt = PT_CV_Functions::wp_trim_words( get_the_content(), $length );
501
  // Get manual excerpt
502
  $excerpt = apply_filters( PT_CV_PREFIX_ . 'field_content_excerpt', $excerpt, $fargs, $post );
503
  // Append readmore button
@@ -608,7 +611,8 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
608
  $has_thumbnail = get_the_post_thumbnail( $post_id );
609
  if ( ! empty( $has_thumbnail ) ) {
610
  $thumbnail_size = count( $dimensions ) > 1 ? $dimensions : $dimensions[0];
611
- $html = get_the_post_thumbnail( $post_id, $thumbnail_size, $gargs );
 
612
  } else {
613
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_not_found', $html, $post, $dimensions, $gargs );
614
  }
@@ -758,9 +762,10 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
758
 
759
  $pagination_btn = '';
760
 
761
- $style = isset( $dargs['pagination-settings']['style'] ) ? $dargs['pagination-settings']['style'] : 'regular';
762
  $type = isset( $dargs['pagination-settings']['type'] ) ? $dargs['pagination-settings']['type'] : 'ajax';
763
- if ( $style == 'regular' ) {
 
 
764
  $pagination_btn = sprintf( '<ul class="%s" data-totalpages="%s" data-sid="%s">%s</ul>', PT_CV_PREFIX . 'pagination' . ' ' . PT_CV_PREFIX . $type . ' pagination', esc_attr( $max_num_pages ), esc_attr( $session_id ), PT_CV_Functions::pagination( $max_num_pages, $current_page ) );
765
  } else {
766
  $pagination_btn = apply_filters( PT_CV_PREFIX_ . 'btn_more_html', $pagination_btn, $max_num_pages, $session_id );
197
  $fields_html[$field_name] = self::field_item_html( $field_name, $post, $fargs );
198
  }
199
 
200
+ $fields_html = apply_filters( PT_CV_PREFIX_ . 'fields_html', $fields_html, $post );
201
+
202
  // Get HTML content of view type, with specific style
203
  $file_path = $view_type_dir . '/' . 'html' . '/' . $style . '.' . 'php';
204
 
498
 
499
  // Get excerpt
500
  if ( $length > 0 ) {
501
+ $content_to_extract = apply_filters( PT_CV_PREFIX_ . 'field_content_to_extract', get_the_content(), $post );
502
  // Extract excerpt from content
503
+ $excerpt = PT_CV_Functions::wp_trim_words( $content_to_extract, $length );
504
  // Get manual excerpt
505
  $excerpt = apply_filters( PT_CV_PREFIX_ . 'field_content_excerpt', $excerpt, $fargs, $post );
506
  // Append readmore button
611
  $has_thumbnail = get_the_post_thumbnail( $post_id );
612
  if ( ! empty( $has_thumbnail ) ) {
613
  $thumbnail_size = count( $dimensions ) > 1 ? $dimensions : $dimensions[0];
614
+ $html = get_the_post_thumbnail( $post_id, $thumbnail_size, $gargs );
615
+ $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_image', $html, $post_id, $dimensions, $fargs );
616
  } else {
617
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_not_found', $html, $post, $dimensions, $gargs );
618
  }
762
 
763
  $pagination_btn = '';
764
 
 
765
  $type = isset( $dargs['pagination-settings']['type'] ) ? $dargs['pagination-settings']['type'] : 'ajax';
766
+ $style = isset( $dargs['pagination-settings']['style'] ) ? $dargs['pagination-settings']['style'] : 'regular';
767
+
768
+ if ( $type == 'normal' || $style == 'regular' ) {
769
  $pagination_btn = sprintf( '<ul class="%s" data-totalpages="%s" data-sid="%s">%s</ul>', PT_CV_PREFIX . 'pagination' . ' ' . PT_CV_PREFIX . $type . ' pagination', esc_attr( $max_num_pages ), esc_attr( $session_id ), PT_CV_Functions::pagination( $max_num_pages, $current_page ) );
770
  } else {
771
  $pagination_btn = apply_filters( PT_CV_PREFIX_ . 'btn_more_html', $pagination_btn, $max_num_pages, $session_id );
includes/settings.php CHANGED
@@ -743,7 +743,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
743
  'name' => $prefix . 'number-columns',
744
  'std' => '2',
745
  'append_text' => '1 &rarr; 4',
746
- 'desc' => __( 'The number of items on each row of grid', PT_CV_DOMAIN ),
747
  ),
748
  ),
749
  'dependence' => array( 'view-type', 'grid' ),
743
  'name' => $prefix . 'number-columns',
744
  'std' => '2',
745
  'append_text' => '1 &rarr; 4',
746
+ 'desc' => __( 'The number of items per row of grid', PT_CV_DOMAIN ),
747
  ),
748
  ),
749
  'dependence' => array( 'view-type', 'grid' ),
public/assets/css/public.css CHANGED
@@ -87,7 +87,7 @@
87
  }
88
 
89
  .pt-cv-thumbnail.pull-left {
90
- margin-right: 20px;
91
  }
92
 
93
  .pt-cv-thumbnail.pull-right {
87
  }
88
 
89
  .pt-cv-thumbnail.pull-left {
90
+ margin-right: 20px !important;
91
  }
92
 
93
  .pt-cv-thumbnail.pull-right {
public/assets/js/public.js CHANGED
@@ -41,8 +41,10 @@
41
 
42
  var selector = _prefix + 'bootstrap-style-css';
43
  var bootstrap_css = $('#' + selector);
44
- bootstrap_css.remove();
45
- $('title').after("<!-- Manually move Bootstrap to top of all styles --><link rel='stylesheet' id='" + selector + "' href='" + bootstrap_css.attr('href') + "' type='text/css' media='all' />");
 
 
46
  },
47
 
48
  /**
41
 
42
  var selector = _prefix + 'bootstrap-style-css';
43
  var bootstrap_css = $('#' + selector);
44
+ if (bootstrap_css.length > 0) {
45
+ bootstrap_css.remove();
46
+ $('title').after("<!-- Manually move Bootstrap to top of all styles --><link rel='stylesheet' id='" + selector + "' href='" + bootstrap_css.attr('href') + "' type='text/css' media='all' />");
47
+ }
48
  },
49
 
50
  /**