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

Version Description

  • Update: Supports qTranslate family plugin (qTranslate, mqTranslate, qTranslate-X)
Download this release

Release Info

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

Code changes from version 1.5.2 to 1.5.3

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
7
- Stable tag: 1.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -133,9 +133,9 @@ You will be forwarded to editing page of View.
133
 
134
  You can create Unlimited Views, in Unlimited websites
135
 
136
- = How can I add View to home page? =
137
 
138
- If you are using a static page as home page, 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? =
@@ -165,6 +165,9 @@ function my_move_bootstrap( $args ) {
165
 
166
  == Changelog ==
167
 
 
 
 
168
  = 1.5.2 =
169
  * Bug fixed: Scrollable list does not show navigation and indicator
170
  * Bug fixed: Prevent duplicated content caused by other plugins (translation plugins...)
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
7
+ Stable tag: 1.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
133
 
134
  You can create Unlimited Views, in Unlimited websites
135
 
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? =
165
 
166
  == Changelog ==
167
 
168
+ = 1.5.3 =
169
+ * Update: Supports qTranslate family plugin (qTranslate, mqTranslate, qTranslate-X)
170
+
171
  = 1.5.2 =
172
  * Bug fixed: Scrollable list does not show navigation and indicator
173
  * Bug fixed: Prevent duplicated content caused by other plugins (translation plugins...)
admin/assets/css/admin.css CHANGED
@@ -99,6 +99,12 @@ html {
99
  width: 100% !important;
100
  }
101
 
 
 
 
 
 
 
102
  /* Group type */
103
  .panel-group .pt-cv-group {
104
  margin-top: 10px;
@@ -116,8 +122,7 @@ html {
116
  font-weight: 400;
117
  }
118
 
119
- .pt-cv-group .checkbox,
120
- .pt-cv-w50 .pt-form-group {
121
  width: 50%;
122
  float: left;
123
  }
@@ -198,6 +203,13 @@ html {
198
  .pt-cv-bg-none {
199
  background: #fff;
200
  }
 
 
 
 
 
 
 
201
 
202
  /* Sortable */
203
  .pt-wrap .ui-sortable {
99
  width: 100% !important;
100
  }
101
 
102
+ .pt-cv-w50 select,
103
+ .pt-cv-w50 radio {
104
+ width: 50%;
105
+ float: left;
106
+ }
107
+
108
  /* Group type */
109
  .panel-group .pt-cv-group {
110
  margin-top: 10px;
122
  font-weight: 400;
123
  }
124
 
125
+ .pt-cv-group .checkbox {
 
126
  width: 50%;
127
  float: left;
128
  }
203
  .pt-cv-bg-none {
204
  background: #fff;
205
  }
206
+ .pt-cv-field-display .unsortable {
207
+ margin-left: -30px !important;
208
+
209
+ }
210
+ .pt-cv-field-display .unsortable label {
211
+ font-weight: bold !important;
212
+ }
213
 
214
  /* Sortable */
215
  .pt-wrap .ui-sortable {
admin/includes/plugin.php CHANGED
@@ -168,7 +168,7 @@ if ( ! class_exists( 'PT_CV_Plugin' ) ) {
168
  self::_field_print(
169
  $field_name,
170
  'checkbox',
171
- __( "Don't load <b>Bootstrap</b> style & script (in frontend of website)", PT_CV_DOMAIN ),
172
  __( 'Only check this option if Bootstrap has been loaded by active theme or other plugins', PT_CV_DOMAIN )
173
  );
174
  }
168
  self::_field_print(
169
  $field_name,
170
  'checkbox',
171
+ __( "Don't load <b>Bootstrap 3</b> style & script (in frontend of website)", PT_CV_DOMAIN ),
172
  __( 'Only check this option if Bootstrap has been loaded by active theme or other plugins', PT_CV_DOMAIN )
173
  );
174
  }
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.2
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.2' );
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.3
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.3' );
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
@@ -55,9 +55,44 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
55
  $language = $sitepress->get_current_language();
56
  }
57
 
 
 
 
 
 
 
 
 
 
58
  return $language;
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  /**
62
  * Get plugin info
63
  *
@@ -613,7 +648,52 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
613
  /**
614
  * Output Items
615
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
616
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  // Store HTML output of each item
618
  $content_items = array();
619
 
@@ -653,29 +733,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
653
  // Filter array of items
654
  $content_items = apply_filters( PT_CV_PREFIX_ . 'content_items', $content_items );
655
 
656
- /**
657
- * Output Pagination
658
- */
659
- $current_page = self::get_current_page( $pargs );
660
- $html = PT_CV_Html::content_items_wrap( $content_items, $current_page, $args['posts_per_page'], $id );
661
-
662
- // Append Pagination HTML if this is first page, or not Ajax calling
663
- $type = isset( $dargs['pagination-settings']['type'] ) ? $dargs['pagination-settings']['type'] : 'ajax';
664
- if ( $args['posts_per_page'] > 0 && ( ( $type == 'ajax' && $current_page === 1 ) || $type == 'normal' ) ) {
665
- // Total post founds
666
- $found_posts = apply_filters( PT_CV_PREFIX_ . 'found_posts', $pt_query->found_posts );
667
-
668
- // Total number of items
669
- $total_items = ( $args['limit'] > 0 && $found_posts > $args['limit'] ) ? $args['limit'] : $found_posts;
670
-
671
- // Total number of pages
672
- $max_num_pages = ceil( $total_items / $args['posts_per_page'] );
673
-
674
- // Output pagination
675
- $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, $current_page, $session_id );
676
- }
677
-
678
- return $html;
679
  }
680
 
681
  /**
@@ -1189,13 +1247,9 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
1189
  // Pagination settings
1190
  $pargs = array( 'session_id' => $session_id, 'page' => (int) esc_sql( $_POST['page'] ) );
1191
 
1192
- // Language
1193
  $language = empty( $_POST['lang'] ) ? '' : esc_sql( $_POST['lang'] );
1194
- // WPML
1195
- global $sitepress;
1196
- if ( $sitepress && $language ) {
1197
- $sitepress->switch_lang( $language, true );
1198
- }
1199
 
1200
  // Show View output
1201
  echo balanceTags( PT_CV_Functions::view_process_settings( null, $settings, $pargs ) );
55
  $language = $sitepress->get_current_language();
56
  }
57
 
58
+ /**
59
+ * qTranslate family (qTranslate, mqTranslate, qTranslate-X)
60
+ * @since 1.5.3
61
+ */
62
+ global $q_config;
63
+ if ( $q_config && ! empty( $q_config['language'] )) {
64
+ $language = $q_config['language'];
65
+ }
66
+
67
  return $language;
68
  }
69
 
70
+ /**
71
+ * Switch language
72
+ *
73
+ * @global type $sitepress
74
+ * @param string $language Current language
75
+ */
76
+ static function switch_language( $language ) {
77
+ if( ! $language )
78
+ return ;
79
+
80
+ // WPML
81
+ global $sitepress;
82
+ if ( $sitepress && $language ) {
83
+ $sitepress->switch_lang( $language, true );
84
+ }
85
+
86
+ /**
87
+ * qTranslate family (qTranslate, mqTranslate, qTranslate-X)
88
+ * @since 1.5.3
89
+ */
90
+ global $q_config;
91
+ if ( $q_config ) {
92
+ $q_config['language'] = $language;
93
+ }
94
+ }
95
+
96
  /**
97
  * Get plugin info
98
  *
648
  /**
649
  * Output Items
650
  */
651
+ $pt_query = array();
652
+ // What kind of content to display
653
+ global $pt_display_what;
654
+
655
+ $pt_display_what = apply_filters( PT_CV_PREFIX_ . 'display_what', 'post' );
656
+ if ( $pt_display_what === 'post' ) {
657
+ // Get $content_items & $pt_query
658
+ extract( self::get_posts_list( $args, $view_type ) );
659
+ } else {
660
+ $content_items = apply_filters( PT_CV_PREFIX_ . 'view_content', array() );
661
+ }
662
+
663
+ /**
664
+ * Output Pagination
665
+ */
666
+ $current_page = self::get_current_page( $pargs );
667
+ $html = PT_CV_Html::content_items_wrap( $content_items, $current_page, $args['posts_per_page'], $id );
668
+
669
+ // Append Pagination HTML if this is first page, or not Ajax calling
670
+ $type = isset( $dargs['pagination-settings']['type'] ) ? $dargs['pagination-settings']['type'] : 'ajax';
671
+ if ( $pt_query && $args['posts_per_page'] > 0 && ( ( $type == 'ajax' && $current_page === 1 ) || $type == 'normal' ) ) {
672
+ // Total post founds
673
+ $found_posts = apply_filters( PT_CV_PREFIX_ . 'found_posts', $pt_query->found_posts );
674
+
675
+ // Total number of items
676
+ $total_items = ( $args['limit'] > 0 && $found_posts > $args['limit'] ) ? $args['limit'] : $found_posts;
677
+
678
+ // Total number of pages
679
+ $max_num_pages = ceil( $total_items / $args['posts_per_page'] );
680
 
681
+ // Output pagination
682
+ $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, $current_page, $session_id );
683
+ }
684
+
685
+ return $html;
686
+ }
687
+
688
+ /**
689
+ * Query posts
690
+ *
691
+ * @global mixed $post
692
+ * @param array $args
693
+ * @param string $view_type
694
+ * @return array
695
+ */
696
+ static function get_posts_list( $args, $view_type ) {
697
  // Store HTML output of each item
698
  $content_items = array();
699
 
733
  // Filter array of items
734
  $content_items = apply_filters( PT_CV_PREFIX_ . 'content_items', $content_items );
735
 
736
+ return array( 'content_items' => $content_items, 'pt_query' => $pt_query );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
737
  }
738
 
739
  /**
1247
  // Pagination settings
1248
  $pargs = array( 'session_id' => $session_id, 'page' => (int) esc_sql( $_POST['page'] ) );
1249
 
1250
+ // Switch language
1251
  $language = empty( $_POST['lang'] ) ? '' : esc_sql( $_POST['lang'] );
1252
+ self::switch_language( $language );
 
 
 
 
1253
 
1254
  // Show View output
1255
  echo balanceTags( PT_CV_Functions::view_process_settings( null, $settings, $pargs ) );
includes/html.php CHANGED
@@ -247,7 +247,7 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
247
 
248
  $result = sprintf( '<div class="%s" %s>%s</div>', esc_attr( implode( ' ', $item_class ) ), $item_filter, balanceTags( $html_item ) );
249
 
250
- return $result;
251
  }
252
 
253
  /**
247
 
248
  $result = sprintf( '<div class="%s" %s>%s</div>', esc_attr( implode( ' ', $item_class ) ), $item_filter, balanceTags( $html_item ) );
249
 
250
+ return apply_filters( PT_CV_PREFIX_ . 'before_item', '', $post_id ) . $result . apply_filters( PT_CV_PREFIX_ . 'after_item', '', $post_id );
251
  }
252
 
253
  /**
includes/settings.php CHANGED
@@ -166,7 +166,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
166
  ),
167
  'dependence' => array( 'enable-pagination', 'yes' ),
168
  ),
169
-
170
  // Pagination Type
171
  array(
172
  'label' => array(
@@ -311,7 +311,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
311
  ),
312
  'extra_setting' => array(
313
  'params' => array(
314
- 'wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'thumbnail-setting',
315
  ),
316
  ),
317
  'params' => array(
@@ -379,7 +379,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
379
  ),
380
  ),
381
  ),
382
-
383
  // Allow HTML tags
384
  array(
385
  'label' => array(
@@ -489,8 +489,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
489
  ),
490
  'extra_setting' => array(
491
  'params' => array(
492
- 'width' => 9,
493
- 'wrap-class' => PT_CV_PREFIX . 'bg-none',
494
  ),
495
  ),
496
  'params' => array(
166
  ),
167
  'dependence' => array( 'enable-pagination', 'yes' ),
168
  ),
169
+
170
  // Pagination Type
171
  array(
172
  'label' => array(
311
  ),
312
  'extra_setting' => array(
313
  'params' => array(
314
+ 'wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'thumbnail-setting' . ' ' . PT_CV_PREFIX . 'w50',
315
  ),
316
  ),
317
  'params' => array(
379
  ),
380
  ),
381
  ),
382
+
383
  // Allow HTML tags
384
  array(
385
  'label' => array(
489
  ),
490
  'extra_setting' => array(
491
  'params' => array(
492
+ 'wrap-class' => PT_CV_PREFIX . 'bg-none' . ' ' . PT_CV_PREFIX . 'w50',
 
493
  ),
494
  ),
495
  'params' => array(
includes/values.php CHANGED
@@ -202,7 +202,7 @@ if ( ! class_exists( 'PT_CV_Values' ) ) {
202
  * @return array
203
  */
204
  static function pagination_types() {
205
- $result = array(
206
  'ajax' => __( 'Ajax', PT_CV_DOMAIN ),
207
  'normal' => __( 'Normal', PT_CV_DOMAIN ),
208
  );
@@ -211,7 +211,7 @@ if ( ! class_exists( 'PT_CV_Values' ) ) {
211
 
212
  return $result;
213
  }
214
-
215
  /**
216
  * Paging styles
217
  *
202
  * @return array
203
  */
204
  static function pagination_types() {
205
+ $result = array(
206
  'ajax' => __( 'Ajax', PT_CV_DOMAIN ),
207
  'normal' => __( 'Normal', PT_CV_DOMAIN ),
208
  );
211
 
212
  return $result;
213
  }
214
+
215
  /**
216
  * Paging styles
217
  *