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

Version Description

  • Bug fixed: Empty date caused by custom hook to WordPress "get_the_date" filter (of another plugin/active theme)
  • Bug fixed: Different output between preview and front-end when excludes some posts (caused by Paid Membership Pro plugin)
  • Improvement: Improve code for better performance
  • Tweak: Rename 'In list' to 'Include only' and update its description
  • Tweak: Replace "Leave a comment" by "0 Comment"
Download this release

Release Info

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

Code changes from version 1.7.2 to 1.7.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, display, recent, posts, recent post, 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.3.1
7
- Stable tag: 1.7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -163,6 +163,13 @@ function my_session_start() {
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
 
 
166
  = 1.7.2 =
167
  * Improvement: Reduce processing time by optimizing conditional statements & functions
168
  * Bug fixed: "No post found" when one of selected terms is hierarchical and operator is AND
4
  Tags: post, display, recent, posts, recent post, 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.3.1
7
+ Stable tag: 1.7.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
163
 
164
  == Changelog ==
165
 
166
+ = 1.7.3 =
167
+ * Bug fixed: Empty date caused by custom hook to WordPress "get_the_date" filter (of another plugin/active theme)
168
+ * Bug fixed: Different output between preview and front-end when excludes some posts (caused by Paid Membership Pro plugin)
169
+ * Improvement: Improve code for better performance
170
+ * Tweak: Rename 'In list' to 'Include only' and update its description
171
+ * Tweak: Replace "Leave a comment" by "0 Comment"
172
+
173
  = 1.7.2 =
174
  * Improvement: Reduce processing time by optimizing conditional statements & functions
175
  * Bug fixed: "No post found" when one of selected terms is hierarchical and operator is AND
admin/includes/options.php CHANGED
@@ -265,6 +265,10 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
265
  break;
266
  }
267
 
 
 
 
 
268
  $options = '';
269
  foreach ( $param[ 'options' ] as $key => $text ) {
270
  $selected = ( in_array( $key, (array) $value ) || ( $value == 'all' ) ) ? 'selected' : '';
265
  break;
266
  }
267
 
268
+ if ( is_string( $value ) && strpos( $value, ',' ) !== false ) {
269
+ $value = explode( ',', $value );
270
+ }
271
+
272
  $options = '';
273
  foreach ( $param[ 'options' ] as $key => $text ) {
274
  $selected = ( in_array( $key, (array) $value ) || ( $value == 'all' ) ) ? 'selected' : '';
admin/views/view.php CHANGED
@@ -173,14 +173,14 @@ PT_CV_Functions::view_submit();
173
  // Includes
174
  array(
175
  'label' => array(
176
- 'text' => __( 'In list', PT_CV_TEXTDOMAIN ),
177
  ),
178
  'params' => array(
179
  array(
180
  'type' => 'text',
181
  'name' => 'post__in',
182
  'std' => '',
183
- 'desc' => apply_filters( PT_CV_PREFIX_ . 'setting_post_in', __( 'List of post ids to include (comma-separated values, e.g. 1,2,3)', PT_CV_TEXTDOMAIN ) ),
184
  ),
185
  ),
186
  ),
@@ -188,14 +188,14 @@ PT_CV_Functions::view_submit();
188
  // Excludes
189
  array(
190
  'label' => array(
191
- 'text' => __( 'Excludes', PT_CV_TEXTDOMAIN ),
192
  ),
193
  'params' => array(
194
  array(
195
  'type' => 'text',
196
  'name' => 'post__not_in',
197
  'std' => '',
198
- 'desc' => apply_filters( PT_CV_PREFIX_ . 'setting_post_not_in', __( 'List of post ids to exclude (comma-separated values, e.g. 1,2,3)', PT_CV_TEXTDOMAIN ) ),
199
  ),
200
  ),
201
  ),
173
  // Includes
174
  array(
175
  'label' => array(
176
+ 'text' => __( 'Include only', PT_CV_TEXTDOMAIN ),
177
  ),
178
  'params' => array(
179
  array(
180
  'type' => 'text',
181
  'name' => 'post__in',
182
  'std' => '',
183
+ 'desc' => apply_filters( PT_CV_PREFIX_ . 'setting_post_in', __( 'List of post IDs to display (comma-separated values, e.g. 1,2,3)', PT_CV_TEXTDOMAIN ) ),
184
  ),
185
  ),
186
  ),
188
  // Excludes
189
  array(
190
  'label' => array(
191
+ 'text' => __( 'Exclude', PT_CV_TEXTDOMAIN ),
192
  ),
193
  'params' => array(
194
  array(
195
  'type' => 'text',
196
  'name' => 'post__not_in',
197
  'std' => '',
198
+ 'desc' => apply_filters( PT_CV_PREFIX_ . 'setting_post_not_in', __( 'List of post IDs to exclude (comma-separated values, e.g. 1,2,3)', PT_CV_TEXTDOMAIN ) ),
199
  ),
200
  ),
201
  ),
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.7.2
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views-query-and-display-post-page
@@ -27,7 +27,7 @@ if ( !defined( 'WPINC' ) ) {
27
  /*
28
  * Define Constant
29
  */
30
- define( 'PT_CV_VERSION', '1.7.2' );
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.7.3
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views-query-and-display-post-page
27
  /*
28
  * Define Constant
29
  */
30
+ define( 'PT_CV_VERSION', '1.7.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
@@ -721,9 +721,6 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
721
  );
722
  }
723
 
724
- // Unlock Session
725
- session_write_close();
726
-
727
  // Pagination settings
728
  PT_CV_Functions::view_get_pagination_settings( $dargs, $args, $pargs );
729
 
@@ -817,6 +814,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
817
  //print_r( $pt_query->request );
818
  // The Loop
819
  if ( $pt_query->have_posts() ) {
 
820
  while ( $pt_query->have_posts() ) {
821
  $pt_query->the_post();
822
  global $post;
@@ -824,7 +822,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
824
  // Output HTML for this item
825
  $_post = apply_filters( PT_CV_PREFIX_ . 'show_this_post', $post );
826
  if ( $_post ) {
827
- $content_items[ $post->ID ] = PT_CV_Html::view_type_output( $view_type, $post );
828
  }
829
  }
830
  } else {
@@ -860,7 +858,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
860
  * Set default values
861
  */
862
  $args = array(
863
- 'post_type' => $content_type,
864
  'post_status' => apply_filters( PT_CV_PREFIX_ . 'post_status', array( 'publish' ) ),
865
  );
866
 
@@ -921,8 +919,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
921
  // View type settings
922
  $dargs[ 'view-type-settings' ] = PT_CV_Functions::settings_values_by_prefix( PT_CV_PREFIX . $view_type . '-' );
923
 
924
- global $pt_cv_glb, $pt_cv_id;
925
- $pt_cv_glb[ $pt_cv_id ][ 'dargs' ] = $dargs;
926
 
927
  return $dargs;
928
  }
@@ -1550,6 +1547,19 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1550
  return $default;
1551
  }
1552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1553
  /**
1554
  * Get global variable
1555
  *
721
  );
722
  }
723
 
 
 
 
724
  // Pagination settings
725
  PT_CV_Functions::view_get_pagination_settings( $dargs, $args, $pargs );
726
 
814
  //print_r( $pt_query->request );
815
  // The Loop
816
  if ( $pt_query->have_posts() ) {
817
+ $post_idx = 0;
818
  while ( $pt_query->have_posts() ) {
819
  $pt_query->the_post();
820
  global $post;
822
  // Output HTML for this item
823
  $_post = apply_filters( PT_CV_PREFIX_ . 'show_this_post', $post );
824
  if ( $_post ) {
825
+ $content_items[ $post->ID ] = PT_CV_Html::view_type_output( $view_type, $post, $post_idx++ );
826
  }
827
  }
828
  } else {
858
  * Set default values
859
  */
860
  $args = array(
861
+ 'post_type' => apply_filters( PT_CV_PREFIX_ . 'post_type', $content_type ),
862
  'post_status' => apply_filters( PT_CV_PREFIX_ . 'post_status', array( 'publish' ) ),
863
  );
864
 
919
  // View type settings
920
  $dargs[ 'view-type-settings' ] = PT_CV_Functions::settings_values_by_prefix( PT_CV_PREFIX . $view_type . '-' );
921
 
922
+ PT_CV_Functions::set_global_variable( 'dargs', $dargs );
 
923
 
924
  return $dargs;
925
  }
1547
  return $default;
1548
  }
1549
 
1550
+ /**
1551
+ * Set global variable
1552
+ *
1553
+ * @global array $pt_cv_glb
1554
+ * @global string $pt_cv_id
1555
+ * @param string $variable
1556
+ * @return mixed
1557
+ */
1558
+ static function set_global_variable( $variable, $value ) {
1559
+ global $pt_cv_glb, $pt_cv_id;
1560
+ $pt_cv_glb[ $pt_cv_id ][ $variable ] = $value;
1561
+ }
1562
+
1563
  /**
1564
  * Get global variable
1565
  *
includes/hooks.php CHANGED
@@ -24,6 +24,7 @@ if ( !class_exists( 'PT_CV_Hooks' ) ) {
24
  add_filter( PT_CV_PREFIX_ . 'validate_settings', array( __CLASS__, 'filter_validate_settings' ), 10, 2 );
25
 
26
  // Do action
 
27
  }
28
 
29
  /**
@@ -103,6 +104,17 @@ if ( !class_exists( 'PT_CV_Hooks' ) ) {
103
  return array_filter( $errors );
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
106
  }
107
 
108
  }
24
  add_filter( PT_CV_PREFIX_ . 'validate_settings', array( __CLASS__, 'filter_validate_settings' ), 10, 2 );
25
 
26
  // Do action
27
+ add_action( PT_CV_PREFIX_ . 'before_query', array( __CLASS__, 'action_before_query' ) );
28
  }
29
 
30
  /**
104
  return array_filter( $errors );
105
  }
106
 
107
+ public static function action_before_query() {
108
+ /** Fix problem with Paid Membership Pro plugin
109
+ * It resets (instead of append) "post__not_in" parameter of WP query which makes:
110
+ * - exclude function doesn't work
111
+ * - output in Preview panel is different from output in front-end
112
+ */
113
+ if ( function_exists( 'pmpro_search_filter' ) ) {
114
+ remove_filter( 'pre_get_posts', 'pmpro_search_filter' );
115
+ }
116
+ }
117
+
118
  }
119
 
120
  }
includes/html.php CHANGED
@@ -156,8 +156,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
156
  * @param object $post The post object
157
  * @param string $style The style of view type (main, style2...)
158
  */
159
- static function view_type_output( $view_type, $post, $style = 'main' ) {
160
-
161
  $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
162
  $content = NULL;
163
 
@@ -183,11 +182,12 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
183
 
184
  // Generate HTML output of all content fields
185
  $fields_html = array();
186
- foreach ( $dargs[ 'fields' ] as $field_name ) {
 
187
  // Get settings of fields
188
- $fargs = isset( $dargs[ 'field-settings' ] ) ? $dargs[ 'field-settings' ] : array();
189
 
190
- $fargs[ 'layout-format' ] = $dargs[ 'layout-format' ];
191
 
192
  // Get HTML output of field
193
  $item_html = self::field_item_html( $field_name, $post, $fargs );
@@ -222,23 +222,18 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
222
  * @return string Full HTML output of a item
223
  */
224
  static function content_item_wrap( $html_item, $class = '', $post_id = 0 ) {
225
-
226
- $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
227
-
228
  if ( empty( $html_item ) ) {
229
  return '';
230
  }
231
 
232
- if ( is_array( $dargs ) ) {
233
- // If only show Title
234
- if ( isset( $dargs[ 'fields' ] ) && count( (array) $dargs[ 'fields' ] ) == 1 && $dargs[ 'fields' ][ 0 ] === 'title' ) {
235
- $class .= ' ' . PT_CV_PREFIX . 'only-title';
236
- }
237
- }
238
 
239
- // Get wrapper class of a item
240
- $item_class = apply_filters( PT_CV_PREFIX_ . 'content_item_class', array( $class, PT_CV_PREFIX . 'content-item', PT_CV_PREFIX . $dargs[ 'layout-format' ] ) );
 
 
241
 
 
242
  $item_filter = apply_filters( PT_CV_PREFIX_ . 'content_item_filter_value', '', $post_id );
243
 
244
  // Add custom HTML for each item
@@ -262,7 +257,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
262
  * @return string Full HTML output for Content View
263
  */
264
  static function content_items_wrap( $content_items, $current_page, $post_per_page, $id ) {
265
- global $pt_cv_glb, $pt_cv_id;
266
  $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
267
 
268
  if ( empty( $content_items ) ) {
@@ -270,7 +265,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
270
  }
271
 
272
  // Assign as global variable
273
- $pt_cv_glb[ $pt_cv_id ][ 'content_items' ] = $content_items;
274
 
275
  $nonpaging_or_firstpage = PT_CV_Functions::nonpaging_or_firstpage( $dargs, $current_page );
276
 
@@ -569,58 +564,54 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
569
  * HTML output of thumbnail field
570
  *
571
  * @param object $post The post object
572
- * @param array $fargs The settings of this field
573
  *
574
  * @return string
575
  */
576
- static function _field_thumbnail( $post, $fargs ) {
577
-
578
- $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
579
-
580
- // Get layout format
581
- $layout_format = $fargs[ 'layout-format' ];
582
 
583
  // Get thumbnail settings
584
- $fargs = $fargs[ 'thumbnail' ];
585
-
586
- $html = '';
587
- $wrapper_class = '';
588
 
589
- // Get post ID
590
- $post_id = $post->ID;
591
-
592
- // Custom args for get_the_post_thumbnail function
593
  $thumbnail_class = array();
594
  $thumbnail_class[] = PT_CV_PREFIX . 'thumbnail';
595
  $thumbnail_class[] = isset( $fargs[ 'style' ] ) ? $fargs[ 'style' ] : '';
596
  if ( $layout_format === '2-col' ) {
597
- $wrapper_class = isset( $fargs[ 'position' ] ) ? 'pull-' . $fargs[ 'position' ] : 'pull-left';
598
- $thumbnail_class[] = $wrapper_class;
599
- $wrapper_class = str_replace( 'pull', '', $wrapper_class );
600
  }
601
  $gargs = array(
602
  'class' => apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_class', implode( ' ', array_filter( $thumbnail_class ) ) ),
603
  );
604
 
605
  // Get thumbnail dimensions
606
- $dimensions = PT_CV_Functions::field_thumbnail_dimensions( $fargs );
607
- $dimensions = (array) apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_dimension_output', $dimensions, $fargs );
608
 
609
  // Check if has thumbnail ( has_post_thumbnail doesn't works )
610
- $thumbnail_id = get_post_thumbnail_id( $post_id );
 
611
  // Check if user doesn't want to load thumbnail: field_thumbnail_load = 0
612
- $load_thumbnail = !empty( $thumbnail_id ) && apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_load', 1 );
 
 
613
  if ( $load_thumbnail ) {
614
  $thumbnail_size = count( $dimensions ) > 1 ? $dimensions : $dimensions[ 0 ];
615
  $html = wp_get_attachment_image( (int) $thumbnail_id, $thumbnail_size, false, $gargs );
616
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_image', $html, $post, $dimensions, $fargs );
617
- } else {
 
 
 
618
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_not_found', $html, $post, $dimensions, $gargs );
619
  }
620
 
621
  // Add link to thumbnail
 
622
  $oargs = isset( $dargs[ 'other-settings' ] ) ? $dargs[ 'other-settings' ] : array();
623
- $html = self::_field_href( $oargs, $post, $html, implode( ' ', array( PT_CV_PREFIX . 'href-thumbnail', $wrapper_class ? PT_CV_PREFIX . 'col' . $wrapper_class : '' ) ) );
624
 
625
  return $html;
626
  }
@@ -650,10 +641,8 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
650
  // Get date wrapper class
651
  $date_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_class', 'entry-date', 'date' );
652
  $prefix_text = apply_filters( PT_CV_PREFIX_ . 'field_meta_prefix_text', '', 'date' );
653
- $date_format = apply_filters( PT_CV_PREFIX_ . 'field_meta_date_format', '' ); // set empty to get default option of WP
654
- // Used to fix empty date, caused by hook to WordPress "get_the_date" filter of another plugin/active theme
655
- $date = apply_filters( PT_CV_PREFIX_ . 'field_meta_date_empty', get_the_date( $date_format, $post ), $date_format, $post );
656
- $date = apply_filters( PT_CV_PREFIX_ . 'field_meta_date_final', $date, get_the_time( 'U' ) );
657
 
658
  $html[ 'date' ] = sprintf( '<span class="%s">%s <time datetime="%s">%s</time></span>', esc_html( $date_class ), $prefix_text, esc_attr( get_the_date( 'c' ) ), esc_html( $date ) );
659
  break;
@@ -678,7 +667,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
678
  $prefix_text = apply_filters( PT_CV_PREFIX_ . 'field_meta_prefix_text', '', 'comment' );
679
 
680
  ob_start();
681
- comments_popup_link( __( 'Leave a comment', PT_CV_TEXTDOMAIN ), __( '1 Comment', PT_CV_TEXTDOMAIN ), __( '% Comments', PT_CV_TEXTDOMAIN ) );
682
  $comment_content = ob_get_clean();
683
  $html[ 'comment' ] = sprintf( '<span class="%s">%s %s</span>', esc_attr( $comment_class ), $prefix_text, $comment_content );
684
  endif;
156
  * @param object $post The post object
157
  * @param string $style The style of view type (main, style2...)
158
  */
159
+ static function view_type_output( $view_type, $post, $post_idx = 0, $style = 'main' ) {
 
160
  $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
161
  $content = NULL;
162
 
182
 
183
  // Generate HTML output of all content fields
184
  $fields_html = array();
185
+ $other_dargs = apply_filters( PT_CV_PREFIX_ . 'dargs_others', $dargs, $post_idx );
186
+ foreach ( $other_dargs[ 'fields' ] as $field_name ) {
187
  // Get settings of fields
188
+ $fargs = isset( $other_dargs[ 'field-settings' ] ) ? $other_dargs[ 'field-settings' ] : array();
189
 
190
+ $fargs[ 'layout-format' ] = $other_dargs[ 'layout-format' ];
191
 
192
  // Get HTML output of field
193
  $item_html = self::field_item_html( $field_name, $post, $fargs );
222
  * @return string Full HTML output of a item
223
  */
224
  static function content_item_wrap( $html_item, $class = '', $post_id = 0 ) {
 
 
 
225
  if ( empty( $html_item ) ) {
226
  return '';
227
  }
228
 
229
+ $dargs = (array) PT_CV_Functions::get_global_variable( 'dargs' );
 
 
 
 
 
230
 
231
+ // If only show Title
232
+ if ( isset( $dargs[ 'fields' ] ) && count( (array) $dargs[ 'fields' ] ) == 1 && $dargs[ 'fields' ][ 0 ] === 'title' ) {
233
+ $class .= ' ' . PT_CV_PREFIX . 'only-title';
234
+ }
235
 
236
+ $item_class = apply_filters( PT_CV_PREFIX_ . 'content_item_class', array( $class, PT_CV_PREFIX . 'content-item', PT_CV_PREFIX . $dargs[ 'layout-format' ] ) );
237
  $item_filter = apply_filters( PT_CV_PREFIX_ . 'content_item_filter_value', '', $post_id );
238
 
239
  // Add custom HTML for each item
257
  * @return string Full HTML output for Content View
258
  */
259
  static function content_items_wrap( $content_items, $current_page, $post_per_page, $id ) {
260
+
261
  $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
262
 
263
  if ( empty( $content_items ) ) {
265
  }
266
 
267
  // Assign as global variable
268
+ PT_CV_Functions::set_global_variable( 'content_items', $content_items );
269
 
270
  $nonpaging_or_firstpage = PT_CV_Functions::nonpaging_or_firstpage( $dargs, $current_page );
271
 
564
  * HTML output of thumbnail field
565
  *
566
  * @param object $post The post object
567
+ * @param array $_fargs The settings of this field
568
  *
569
  * @return string
570
  */
571
+ static function _field_thumbnail( $post, $_fargs ) {
572
+ $layout_format = $_fargs[ 'layout-format' ];
 
 
 
 
573
 
574
  // Get thumbnail settings
575
+ $fargs = $_fargs[ 'thumbnail' ];
 
 
 
576
 
577
+ // Thumbnail class
578
+ $thumbnail_position = 'default';
 
 
579
  $thumbnail_class = array();
580
  $thumbnail_class[] = PT_CV_PREFIX . 'thumbnail';
581
  $thumbnail_class[] = isset( $fargs[ 'style' ] ) ? $fargs[ 'style' ] : '';
582
  if ( $layout_format === '2-col' ) {
583
+ $thumbnail_position = isset( $fargs[ 'position' ] ) ? $fargs[ 'position' ] : 'left';
584
+ $thumbnail_class[] = 'pull-' . $thumbnail_position;
 
585
  }
586
  $gargs = array(
587
  'class' => apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_class', implode( ' ', array_filter( $thumbnail_class ) ) ),
588
  );
589
 
590
  // Get thumbnail dimensions
591
+ $dimensions = (array) apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_dimension_output', PT_CV_Functions::field_thumbnail_dimensions( $fargs ), $fargs );
 
592
 
593
  // Check if has thumbnail ( has_post_thumbnail doesn't works )
594
+ $thumbnail_id = get_post_thumbnail_id( $post->ID );
595
+
596
  // Check if user doesn't want to load thumbnail: field_thumbnail_load = 0
597
+ $load_thumbnail = !empty( $thumbnail_id ) && apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_load', 1 );
598
+
599
+ $html = '';
600
  if ( $load_thumbnail ) {
601
  $thumbnail_size = count( $dimensions ) > 1 ? $dimensions : $dimensions[ 0 ];
602
  $html = wp_get_attachment_image( (int) $thumbnail_id, $thumbnail_size, false, $gargs );
603
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_image', $html, $post, $dimensions, $fargs );
604
+ }
605
+
606
+ // If no thumbnail
607
+ if ( empty( $html ) ) {
608
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_not_found', $html, $post, $dimensions, $gargs );
609
  }
610
 
611
  // Add link to thumbnail
612
+ $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
613
  $oargs = isset( $dargs[ 'other-settings' ] ) ? $dargs[ 'other-settings' ] : array();
614
+ $html = self::_field_href( $oargs, $post, $html, implode( ' ', array( PT_CV_PREFIX . 'href-thumbnail', PT_CV_PREFIX . 'thumb-' . $thumbnail_position ) ) );
615
 
616
  return $html;
617
  }
641
  // Get date wrapper class
642
  $date_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_class', 'entry-date', 'date' );
643
  $prefix_text = apply_filters( PT_CV_PREFIX_ . 'field_meta_prefix_text', '', 'date' );
644
+ $date_format = apply_filters( PT_CV_PREFIX_ . 'field_meta_date_format', get_option( 'date_format' ) );
645
+ $date = apply_filters( PT_CV_PREFIX_ . 'field_meta_date_final', mysql2date( $date_format, $post->post_date ), get_the_time( 'U' ) );
 
 
646
 
647
  $html[ 'date' ] = sprintf( '<span class="%s">%s <time datetime="%s">%s</time></span>', esc_html( $date_class ), $prefix_text, esc_attr( get_the_date( 'c' ) ), esc_html( $date ) );
648
  break;
667
  $prefix_text = apply_filters( PT_CV_PREFIX_ . 'field_meta_prefix_text', '', 'comment' );
668
 
669
  ob_start();
670
+ comments_popup_link( __( '0 Comment', PT_CV_TEXTDOMAIN ), __( '1 Comment', PT_CV_TEXTDOMAIN ), __( '% Comments', PT_CV_TEXTDOMAIN ) );
671
  $comment_content = ob_get_clean();
672
  $html[ 'comment' ] = sprintf( '<span class="%s">%s %s</span>', esc_attr( $comment_class ), $prefix_text, $comment_content );
673
  endif;
includes/values.php CHANGED
@@ -382,7 +382,7 @@ if ( !class_exists( 'PT_CV_Values' ) ) {
382
  static function layout_format() {
383
 
384
  $result = array(
385
- '1-col' => __( '1 column &#8212; All fields inside an output item are shown in one column', PT_CV_TEXTDOMAIN ),
386
  '2-col' => __( '2 columns &#8212; Show thumbnail on the left/right side of other fields', PT_CV_TEXTDOMAIN ),
387
  );
388
 
382
  static function layout_format() {
383
 
384
  $result = array(
385
+ '1-col' => __( '1 column &#8212; Show all fields in one column', PT_CV_TEXTDOMAIN ),
386
  '2-col' => __( '2 columns &#8212; Show thumbnail on the left/right side of other fields', PT_CV_TEXTDOMAIN ),
387
  );
388
 
languages/content-views-query-and-display-post-page.po CHANGED
@@ -652,7 +652,7 @@ msgstr ""
652
 
653
  #: code/includes/values.php:385
654
  msgid ""
655
- "1 column &#8212; All fields inside an output item are shown in one column"
656
  msgstr ""
657
 
658
  #: code/includes/values.php:386
652
 
653
  #: code/includes/values.php:385
654
  msgid ""
655
+ "1 column &#8212; Show all fields in one column"
656
  msgstr ""
657
 
658
  #: code/includes/values.php:386