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

Version Description

  • Bug fixed: Length of excerpt is wrong if there is filter of other plugin or active theme
  • Improvement: GUI improvement in "Fields settings" group
Download this release

Release Info

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

Code changes from version 1.4.3 to 1.4.4

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, 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.0.1
7
- Stable tag: 1.4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -144,6 +144,10 @@ You can create Unlimited Views, in Unlimited websites
144
 
145
  == Changelog ==
146
 
 
 
 
 
147
  = 1.4.3 =
148
  * Bug fixed: Scrollable list without image display blank output
149
  * Bug fixed: Position of pagination button is incorrect after pagination finished (in some case)
4
  Tags: post, posts, page, pages, query, queries, search, display, show, grid, 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.0.1
7
+ Stable tag: 1.4.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
144
 
145
  == Changelog ==
146
 
147
+ = 1.4.4 =
148
+ * Bug fixed: Length of excerpt is wrong if there is filter of other plugin or active theme
149
+ * Improvement: GUI improvement in "Fields settings" group
150
+
151
  = 1.4.3 =
152
  * Bug fixed: Scrollable list without image display blank output
153
  * Bug fixed: Position of pagination button is incorrect after pagination finished (in some case)
admin/assets/css/admin.css CHANGED
@@ -157,7 +157,6 @@ html {
157
 
158
  /* Activate group */
159
  #pt-cv-filter-settings .pt-cv-group-activate {
160
- padding: 5px;
161
  -webkit-box-shadow: inset 0 1px 1px rgba(255, 105, 105, 0.075), 0 0 8px rgba(0, 142, 255, 0.6) !important;
162
  box-shadow: inset 0 1px 1px rgba(255, 105, 105, 0.075), 0 0 8px rgba(0, 142, 255, 0.6) !important;
163
  }
157
 
158
  /* Activate group */
159
  #pt-cv-filter-settings .pt-cv-group-activate {
 
160
  -webkit-box-shadow: inset 0 1px 1px rgba(255, 105, 105, 0.075), 0 0 8px rgba(0, 142, 255, 0.6) !important;
161
  box-shadow: inset 0 1px 1px rgba(255, 105, 105, 0.075), 0 0 8px rgba(0, 142, 255, 0.6) !important;
162
  }
admin/views/view.php CHANGED
@@ -132,6 +132,7 @@ echo balanceTags( PT_Options_Framework::do_settings( $options, $settings ) );
132
  <div class="tab-pane active" id="<?php echo esc_attr( PT_CV_PREFIX ); ?>filter-settings">
133
  <?php
134
  $options = array(
 
135
  array(
136
  'label' => array(
137
  'text' => __( 'Content type', PT_CV_DOMAIN ),
@@ -146,6 +147,24 @@ $options = array(
146
  ),
147
  ),
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  apply_filters( PT_CV_PREFIX_ . 'custom_filters', array() ),
150
 
151
  // Common Filters
@@ -163,7 +182,7 @@ $options = array(
163
  'type' => 'group',
164
  'params' => array(
165
 
166
- apply_filters( PT_CV_PREFIX_ . 'exclude_sticky_posts_setting', array() ),
167
 
168
  // Includes
169
  array(
132
  <div class="tab-pane active" id="<?php echo esc_attr( PT_CV_PREFIX ); ?>filter-settings">
133
  <?php
134
  $options = array(
135
+ // Content type
136
  array(
137
  'label' => array(
138
  'text' => __( 'Content type', PT_CV_DOMAIN ),
147
  ),
148
  ),
149
 
150
+ // Upgrade to Pro
151
+ apply_filters( PT_CV_PREFIX_ . 'upgrade_to_pro_text', array(
152
+ 'label' => array(
153
+ 'text' => '',
154
+ ),
155
+ 'extra_setting' => array(
156
+ 'params' => array(
157
+ 'width' => 10,
158
+ ),
159
+ ),
160
+ 'params' => array(
161
+ array(
162
+ 'type' => 'html',
163
+ 'content' => sprintf( '<p class="text-muted">&rarr; %s</p>', __( 'Filter custom content type (or post type) ?', PT_CV_DOMAIN ) . sprintf( ' <a href="%s" target="_blank">%s</a>', esc_url( 'http://www.contentviewspro.com/pricing/?utm_source=client&utm_medium=view' ), __( 'Please upgrade to Pro', PT_CV_DOMAIN ) ) ),
164
+ ),
165
+ ),
166
+ ) ),
167
+
168
  apply_filters( PT_CV_PREFIX_ . 'custom_filters', array() ),
169
 
170
  // Common Filters
182
  'type' => 'group',
183
  'params' => array(
184
 
185
+ apply_filters( PT_CV_PREFIX_ . 'sticky_posts_setting', array() ),
186
 
187
  // Includes
188
  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.4.3
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.4.3' );
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.4.4
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.4.4' );
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
@@ -174,6 +174,25 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
174
  return ucwords( $slug );
175
  }
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  /**
178
  * Get thumbnail dimensions
179
  *
@@ -454,6 +473,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
454
  return $view_settings;
455
  }
456
 
 
457
  $taxonomies = isset( $view_settings[PT_CV_PREFIX . 'taxonomy'] ) ? $view_settings[PT_CV_PREFIX . 'taxonomy'] : array();
458
  if ( is_array( $taxonomies ) ) {
459
  $list = array( '__in', '__not_in' );
@@ -467,6 +487,8 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
467
  }
468
  }
469
  }
 
 
470
  }
471
 
472
  /**
@@ -639,7 +661,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
639
  $args = array(
640
  'post_type' => $content_type,
641
  'post_status' => 'publish',
642
- 'ignore_sticky_posts' => 1,
643
  );
644
 
645
  // Post in
@@ -865,6 +887,15 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
865
  // Get field settings
866
  switch ( $field ) {
867
 
 
 
 
 
 
 
 
 
 
868
  // Get thumbnail settings
869
  case 'thumbnail':
870
  $prefix = PT_CV_PREFIX . 'field-thumbnail-';
174
  return ucwords( $slug );
175
  }
176
 
177
+ /**
178
+ * Trims text to a certain number of words.
179
+ *
180
+ * @since 1.4.3
181
+ */
182
+ static function wp_trim_words( $text, $num_words = 55 ) {
183
+ $result = wp_strip_all_tags( $text );
184
+ $array = preg_split( "/[\n\r\t ]+/", $result, $num_words + 1, PREG_SPLIT_NO_EMPTY );;
185
+
186
+ // Already short enough, return the whole thing
187
+ if ( count( $array ) > $num_words )
188
+ {
189
+ array_splice( $array, $num_words );
190
+ $result = implode( ' ', $array );
191
+ }
192
+
193
+ return $result;
194
+ }
195
+
196
  /**
197
  * Get thumbnail dimensions
198
  *
473
  return $view_settings;
474
  }
475
 
476
+ // Taxonomy In, Not in
477
  $taxonomies = isset( $view_settings[PT_CV_PREFIX . 'taxonomy'] ) ? $view_settings[PT_CV_PREFIX . 'taxonomy'] : array();
478
  if ( is_array( $taxonomies ) ) {
479
  $list = array( '__in', '__not_in' );
487
  }
488
  }
489
  }
490
+
491
+ $view_settings = apply_filters( PT_CV_PREFIX_ . 'backward_comp', $view_settings );
492
  }
493
 
494
  /**
661
  $args = array(
662
  'post_type' => $content_type,
663
  'post_status' => 'publish',
664
+ 'ignore_sticky_posts' => apply_filters( PT_CV_PREFIX_ . 'ignore_sticky_posts', 1 ),
665
  );
666
 
667
  // Post in
887
  // Get field settings
888
  switch ( $field ) {
889
 
890
+ // Get title settings
891
+ case 'title':
892
+ $prefix = PT_CV_PREFIX . 'field-title-';
893
+ $field_setting = PT_CV_Functions::settings_values_by_prefix( $prefix );
894
+
895
+ $dargs['field-settings'][$field] = apply_filters( PT_CV_PREFIX_ . 'field_title_setting_values', $field_setting, $prefix );
896
+
897
+ break;
898
+
899
  // Get thumbnail settings
900
  case 'thumbnail':
901
  $prefix = PT_CV_PREFIX . 'field-thumbnail-';
includes/html.php CHANGED
@@ -381,22 +381,7 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
381
  // Title
382
  case 'title':
383
 
384
- // Get title class
385
- $title_class = apply_filters( PT_CV_PREFIX_ . 'field_title_class', PT_CV_PREFIX . 'title' );
386
-
387
- // Get title tag
388
- $tag = apply_filters( PT_CV_PREFIX_ . 'field_title_tag', 'h4' );
389
-
390
- // Get post title
391
- $title = get_the_title( $post );
392
- if ( empty( $title ) ) {
393
- $title = __( '(no title)', PT_CV_DOMAIN );
394
- }
395
-
396
- $html = sprintf(
397
- '<%1$s class="%2$s">%3$s</%1$s>',
398
- $tag, esc_attr( $title_class ), self::_field_href( $oargs, $post, $title )
399
- );
400
 
401
  break;
402
 
@@ -430,6 +415,36 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
430
  return $html;
431
  }
432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  /**
434
  * Get content
435
  *
@@ -479,7 +494,7 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
479
  * Don't set $readmore_btn as 3rd parameter for wp_trim_words(),
480
  * to show Read more button always (even if manual excerpt length < $length)
481
  */
482
- $content = $length ? wp_trim_words( $content, $length, '' ) . $readmore_btn : $readmore;
483
 
484
  // Force balance tags
485
  $content = force_balance_tags( strip_shortcodes( $content ) );
381
  // Title
382
  case 'title':
383
 
384
+ $html = self::_field_title( $post, $oargs, $fargs );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
 
386
  break;
387
 
415
  return $html;
416
  }
417
 
418
+ /**
419
+ * Get Title
420
+ *
421
+ * @param object $post
422
+ * @param array $oargs
423
+ * @return string
424
+ */
425
+ static function _field_title( $post, $oargs, $fargs ) {
426
+ // Get title class
427
+ $title_class = apply_filters( PT_CV_PREFIX_ . 'field_title_class', PT_CV_PREFIX . 'title' );
428
+
429
+ // Get title tag
430
+ $tag = apply_filters( PT_CV_PREFIX_ . 'field_title_tag', 'h4' );
431
+
432
+ // Get post title
433
+ $title = get_the_title( $post );
434
+ if ( empty( $title ) ) {
435
+ $title = __( '(no title)', PT_CV_DOMAIN );
436
+ }
437
+
438
+ $title = apply_filters( PT_CV_PREFIX_ . 'field_title_result', $title, $fargs );
439
+
440
+ $html = sprintf(
441
+ '<%1$s class="%2$s">%3$s</%1$s>',
442
+ $tag, esc_attr( $title_class ), self::_field_href( $oargs, $post, $title )
443
+ );
444
+
445
+ return $html;
446
+ }
447
+
448
  /**
449
  * Get content
450
  *
494
  * Don't set $readmore_btn as 3rd parameter for wp_trim_words(),
495
  * to show Read more button always (even if manual excerpt length < $length)
496
  */
497
+ $content = $length ? PT_CV_Functions::wp_trim_words( $content, $length ) . $readmore_btn : $readmore;
498
 
499
  // Force balance tags
500
  $content = force_balance_tags( strip_shortcodes( $content ) );
includes/settings.php CHANGED
@@ -232,11 +232,12 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
232
  // Fields display
233
  array(
234
  'label' => array(
235
- 'text' => __( 'Fields display', PT_CV_DOMAIN ),
236
  ),
237
  'extra_setting' => array(
238
  'params' => array(
239
  'wrap-class' => PT_CV_Html::html_group_class(),
 
240
  ),
241
  ),
242
  'params' => array(
@@ -247,48 +248,46 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
247
  ),
248
  ),
249
 
250
- // Thumbnail settings
251
- array(
252
  'label' => array(
253
- 'text' => __( 'Thumbnail settings', PT_CV_DOMAIN ),
254
  ),
255
  'extra_setting' => array(
256
  'params' => array(
257
- 'wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'thumbnail-setting',
258
  ),
259
  ),
260
  'params' => array(
261
  array(
262
- 'type' => 'group',
263
- 'params' => PT_CV_Settings::field_thumbnail_settings( $prefix ),
264
  ),
265
  ),
266
- 'dependence' => array( $prefix2 . 'thumbnail', 'yes' ),
267
- ),
268
 
269
- // Meta fields settings
 
 
 
270
  array(
271
  'label' => array(
272
- 'text' => __( 'Meta fields settings', PT_CV_DOMAIN ),
273
  ),
274
  'extra_setting' => array(
275
  'params' => array(
276
- 'wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'meta-fields-settings',
277
  ),
278
  ),
279
  'params' => array(
280
  array(
281
  'type' => 'group',
282
- 'params' => PT_CV_Settings::field_meta_fields( 'meta-fields-' ),
283
- 'desc' => apply_filters( PT_CV_PREFIX_ . 'settings_sort_text', '' ),
284
  ),
285
  ),
286
- 'dependence' => array( $prefix2 . 'meta-fields', 'yes' ),
287
  ),
288
 
289
- // Taxonomies settings
290
- apply_filters( PT_CV_PREFIX_ . 'settings_taxonomies_display', array() ),
291
-
292
  // Content settings
293
  array(
294
  'label' => array(
@@ -352,6 +351,29 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
352
  ),
353
  'dependence' => array( array( $prefix . 'content-show', 'excerpt' ) ),
354
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  );
356
 
357
  $result = apply_filters( PT_CV_PREFIX_ . 'field_settings', $result, $prefix2 );
232
  // Fields display
233
  array(
234
  'label' => array(
235
+ 'text' => '',
236
  ),
237
  'extra_setting' => array(
238
  'params' => array(
239
  'wrap-class' => PT_CV_Html::html_group_class(),
240
+ 'width' => 12,
241
  ),
242
  ),
243
  'params' => array(
248
  ),
249
  ),
250
 
251
+ // Upgrade to Pro
252
+ apply_filters( PT_CV_PREFIX_ . 'upgrade_to_pro_text', array(
253
  'label' => array(
254
+ 'text' => '',
255
  ),
256
  'extra_setting' => array(
257
  'params' => array(
258
+ 'width' => 12,
259
  ),
260
  ),
261
  'params' => array(
262
  array(
263
+ 'type' => 'html',
264
+ 'content' => sprintf( '<p class="text-muted" style="margin-top: -10px; margin-bottom: 15px;">&rarr; %s</p>', __( 'Customize display order of above fields by a simple drag-and-drop ?', PT_CV_DOMAIN ) . sprintf( ' <a href="%s" target="_blank">%s</a>', esc_url( 'http://www.contentviewspro.com/pricing/?utm_source=client&utm_medium=view' ), __( 'Please upgrade to Pro', PT_CV_DOMAIN ) ) ),
265
  ),
266
  ),
267
+ ) ),
 
268
 
269
+ // Title settings
270
+ apply_filters( PT_CV_PREFIX_ . 'settings_title_display', array(), $prefix, $prefix2 ),
271
+
272
+ // Thumbnail settings
273
  array(
274
  'label' => array(
275
+ 'text' => __( 'Thumbnail settings', PT_CV_DOMAIN ),
276
  ),
277
  'extra_setting' => array(
278
  'params' => array(
279
+ 'wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'thumbnail-setting',
280
  ),
281
  ),
282
  'params' => array(
283
  array(
284
  'type' => 'group',
285
+ 'params' => PT_CV_Settings::field_thumbnail_settings( $prefix ),
 
286
  ),
287
  ),
288
+ 'dependence' => array( $prefix2 . 'thumbnail', 'yes' ),
289
  ),
290
 
 
 
 
291
  // Content settings
292
  array(
293
  'label' => array(
351
  ),
352
  'dependence' => array( array( $prefix . 'content-show', 'excerpt' ) ),
353
  ),
354
+
355
+ // Meta fields settings
356
+ array(
357
+ 'label' => array(
358
+ 'text' => __( 'Meta fields settings', PT_CV_DOMAIN ),
359
+ ),
360
+ 'extra_setting' => array(
361
+ 'params' => array(
362
+ 'wrap-class' => PT_CV_Html::html_group_class() . ' ' . PT_CV_PREFIX . 'meta-fields-settings',
363
+ ),
364
+ ),
365
+ 'params' => array(
366
+ array(
367
+ 'type' => 'group',
368
+ 'params' => PT_CV_Settings::field_meta_fields( 'meta-fields-' ),
369
+ 'desc' => apply_filters( PT_CV_PREFIX_ . 'settings_sort_text', '' ),
370
+ ),
371
+ ),
372
+ 'dependence' => array( $prefix2 . 'meta-fields', 'yes' ),
373
+ ),
374
+
375
+ // Taxonomies settings
376
+ apply_filters( PT_CV_PREFIX_ . 'settings_taxonomies_display', array(), 'meta-fields-' ),
377
  );
378
 
379
  $result = apply_filters( PT_CV_PREFIX_ . 'field_settings', $result, $prefix2 );