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

Version Description

  • January 11 2016 =
  • Update: Set Administrator (instead of Editor) as default user role who can add, edit, delete View
  • Update: Do not wrap items in output to rows anymore
  • Update: Disable sub View by default
  • Improvement: Better View dashboard (simplified text & description, improved styles & scripts, improved display in Tablet)
  • Improvement: Better performance by better solution
Download this release

Release Info

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

Code changes from version 1.7.5 to 1.7.6

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, 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.4
7
- Stable tag: 1.7.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -150,6 +150,13 @@ add_filter( 'pt_cv_start_session', '__return_false' );
150
 
151
  == Changelog ==
152
 
 
 
 
 
 
 
 
153
  = 1.7.5 =
154
  * New feature: Able to disable feature "responsive image" of WordPress 4.4 to prevent blurry thumbnail
155
  * New feature: Able to disable 2-columns format in Mobile devices & extra small screens
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
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.4.1
7
+ Stable tag: 1.7.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
150
 
151
  == Changelog ==
152
 
153
+ = 1.7.6 - January 11 2016 =
154
+ * Update: Set Administrator (instead of Editor) as default user role who can add, edit, delete View
155
+ * Update: Do not wrap items in output to rows anymore
156
+ * Update: Disable sub View by default
157
+ * Improvement: Better View dashboard (simplified text & description, improved styles & scripts, improved display in Tablet)
158
+ * Improvement: Better performance by better solution
159
+
160
  = 1.7.5 =
161
  * New feature: Able to disable feature "responsive image" of WordPress 4.4 to prevent blurry thumbnail
162
  * New feature: Able to disable 2-columns format in Mobile devices & extra small screens
admin/assets/css/admin.css CHANGED
@@ -97,10 +97,6 @@ html {
97
  width: 100px !important;
98
  }
99
 
100
- .pt-cv-full-fields .checkbox {
101
- width: 100% !important;
102
- }
103
-
104
  .pt-cv-w50 select,
105
  .pt-cv-w50 radio {
106
  width: 50%;
@@ -136,8 +132,18 @@ html {
136
  }
137
 
138
  .pt-cv-group .checkbox {
139
- width: 50%;
140
  float: left;
 
 
 
 
 
 
 
 
 
 
 
141
  }
142
 
143
  .pt-cv-group .radio {
@@ -150,10 +156,6 @@ html {
150
  height: 100px;
151
  }
152
 
153
- .pt-cv-group .checkbox {
154
- background: none;
155
- }
156
-
157
  .pt-cv-no-panel {
158
  margin-top: 0px;
159
  }
@@ -238,7 +240,6 @@ html {
238
  }
239
 
240
  .pt-cv-content-setting {
241
- padding-bottom: 10px;
242
  z-index: 1;
243
  }
244
 
@@ -273,7 +274,7 @@ html {
273
  /* Append group */
274
  .pt-cv-excerpt-setting > .pt-params {
275
  border-top: none !important;
276
- margin-top: -20px !important;
277
  }
278
 
279
  .pt-cv-excerpt-setting > .pt-params > .pt-form-group {
@@ -285,3 +286,33 @@ html {
285
  }
286
  /* End Append group */
287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  width: 100px !important;
98
  }
99
 
 
 
 
 
100
  .pt-cv-w50 select,
101
  .pt-cv-w50 radio {
102
  width: 50%;
132
  }
133
 
134
  .pt-cv-group .checkbox {
 
135
  float: left;
136
+ background: none;
137
+ }
138
+
139
+ #pt-cv-group-advanced-params .checkbox,
140
+ .pt-cv-taxonomies .checkbox
141
+ {
142
+ width: 50%;
143
+ }
144
+
145
+ .pt-cv-taxonomies .text-muted {
146
+ margin-top: 5px;
147
  }
148
 
149
  .pt-cv-group .radio {
156
  height: 100px;
157
  }
158
 
 
 
 
 
159
  .pt-cv-no-panel {
160
  margin-top: 0px;
161
  }
240
  }
241
 
242
  .pt-cv-content-setting {
 
243
  z-index: 1;
244
  }
245
 
274
  /* Append group */
275
  .pt-cv-excerpt-setting > .pt-params {
276
  border-top: none !important;
277
+ margin-top: -11px !important;
278
  }
279
 
280
  .pt-cv-excerpt-setting > .pt-params > .pt-form-group {
286
  }
287
  /* End Append group */
288
 
289
+ @media (max-width: 991px) {
290
+ #pt-cv-form-view .nav .glyphicon {
291
+ display: none;
292
+ }
293
+ #pt-cv-form-view .nav-tabs>li>a {
294
+ font-size: 14px !important;
295
+ line-height: 1.8;
296
+ }
297
+ #pt-cv-form-view .control-label, .preview-wrapper .control-label {
298
+ font-size: 15px;
299
+ font-weight: 600;
300
+ margin: 6px 0;
301
+ }
302
+ #pt-cv-form-view .control-label:empty {
303
+ display: none;
304
+ }
305
+ #pt-cv-form-view .tab-pane > .form-group > .control-label {
306
+ border-bottom: 2px solid #ff5a5f;
307
+ padding: 0;
308
+ margin-left: 15px;
309
+ font-size: 20px;
310
+ }
311
+ .pt-cv-field-setting {
312
+ min-height: 35px;
313
+ }
314
+ .pt-cv-field-setting > .pt-params {
315
+ margin-top: 10px;
316
+ }
317
+
318
+ }
admin/assets/js/admin.js CHANGED
@@ -282,27 +282,32 @@
282
  var $self = this;
283
  var _prefix = $self.options._prefix;
284
 
285
- // Taxonomies Settings wrapper div
286
  var $wrap_taxonomies = $( '#' + _prefix + 'group-taxonomy' );
 
 
287
 
288
- // Append <div> : "There is no taxonomy for selected content type" before description of Taxonomies
289
- var no_taxonomy_id = _prefix + 'no-taxonomy';
290
- var no_taxonomy_class = _prefix + 'text';
291
- $wrap_taxonomies.find( '.text-muted' ).first().before( '<div id="' + no_taxonomy_id + '" class="' + no_taxonomy_class + '">' + PT_CV_ADMIN.text.no_taxonomy + '</div>' );
292
- var no_taxonomy = $( '#' + no_taxonomy_id );
293
 
294
  // Hide all Taxonomies at beginning
295
  var fn_taxonomy_hide = function ( taxonomies ) {
296
  taxonomies.each( function () {
297
  $( this ).parents( '.checkbox' ).addClass( 'hidden' );
298
  } );
299
- // Hide no taxonomy div
300
- no_taxonomy.addClass( 'hidden' );
301
 
302
- // Hide Terms group
 
 
 
 
 
303
  $( '.panel-group.terms' ).find( '.' + _prefix + 'group' ).addClass( 'hidden' );
304
  };
305
- var $taxonomies = $( '.' + _prefix + 'taxonomy-item' );
 
306
  fn_taxonomy_hide( $taxonomies );
307
 
308
  // Create function to handle
@@ -323,6 +328,7 @@
323
  // Show taxonomies relates to selected post type
324
  if ( this_val !== '' ) {
325
  fn_taxonomy_hide( $taxonomies );
 
326
  $taxonomies.filter( function () {
327
  var val = $( this ).val();
328
  var $taxonomies_of_this = PT_CV_ADMIN.data.post_types_vs_taxonomies[this_val] || '';
@@ -331,18 +337,19 @@
331
  }
332
 
333
  // Show there is no taxonomies
334
- if ( $wrap_taxonomies.find( '.pt-params .checkbox' ).filter( function () {
335
  return !$( this ).hasClass( 'hidden' );
336
  } ).length === 0 ) {
337
- // Show no taxonomy div
338
- no_taxonomy.removeClass( 'hidden' );
 
 
339
  }
340
 
341
  // Trigger custom actions
342
  $( '.pt-wrap' ).trigger( 'content-type-change', [ this_val ] );
343
  };
344
 
345
- // Get "Content Type" input object
346
  var content_type = '[name="' + _prefix + 'content-type' + '"]';
347
 
348
  // Run on page load
@@ -474,7 +481,6 @@
474
  */
475
  _thumbnail_settings: function () {
476
  var _prefix = this.options._prefix;
477
- var _thumbnail_setting_state = 1;
478
 
479
  /**
480
  * Toggle 'Thumbnail settings' when change 'Layout format'
@@ -483,17 +489,11 @@
483
  * @returns void
484
  */
485
  var fn_thumbnail_setting = function ( this_val ) {
 
486
 
487
- var $thumbnail_wrapper = $( '.' + _prefix + 'thumbnail-setting' ).parent();
488
- if ( this_val === '2-col' ) {
489
- _thumbnail_setting_state = $thumbnail_wrapper.hasClass( 'hidden' ) ? 0 : 1;
490
- $thumbnail_wrapper.removeClass( 'hidden' );
491
- } else if ( this_val === '1-col' ) {
492
- if ( _thumbnail_setting_state ) {
493
- $thumbnail_wrapper.removeClass( 'hidden' );
494
- } else {
495
- $thumbnail_wrapper.addClass( 'hidden' );
496
- }
497
  }
498
  };
499
 
282
  var $self = this;
283
  var _prefix = $self.options._prefix;
284
 
 
285
  var $wrap_taxonomies = $( '#' + _prefix + 'group-taxonomy' );
286
+ var $taxonomy_other_settings = $( '#' + _prefix + 'group-taxonomy-child > .panel-body > .pt-form-group:gt(0)' );
287
+ var $taxonomies = $( '.' + _prefix + 'taxonomy-item' );
288
 
289
+ var $no_taxonomy = $( '<div/>', {
290
+ 'id': _prefix + 'no-taxonomy',
291
+ 'class': _prefix + 'text',
292
+ 'text': PT_CV_ADMIN.text.no_taxonomy,
293
+ } ).insertBefore( $wrap_taxonomies.find( '.text-muted' ).first() );
294
 
295
  // Hide all Taxonomies at beginning
296
  var fn_taxonomy_hide = function ( taxonomies ) {
297
  taxonomies.each( function () {
298
  $( this ).parents( '.checkbox' ).addClass( 'hidden' );
299
  } );
 
 
300
 
301
+ // Toggle show
302
+ $no_taxonomy.addClass( 'hidden' );
303
+ $no_taxonomy.next( '.text-muted' ).removeClass( 'hidden' );
304
+ $taxonomy_other_settings.removeClass( 'hidden' );
305
+
306
+ // Hide all Terms
307
  $( '.panel-group.terms' ).find( '.' + _prefix + 'group' ).addClass( 'hidden' );
308
  };
309
+
310
+ // Run on page load
311
  fn_taxonomy_hide( $taxonomies );
312
 
313
  // Create function to handle
328
  // Show taxonomies relates to selected post type
329
  if ( this_val !== '' ) {
330
  fn_taxonomy_hide( $taxonomies );
331
+
332
  $taxonomies.filter( function () {
333
  var val = $( this ).val();
334
  var $taxonomies_of_this = PT_CV_ADMIN.data.post_types_vs_taxonomies[this_val] || '';
337
  }
338
 
339
  // Show there is no taxonomies
340
+ if ( $wrap_taxonomies.find( '.' + _prefix + 'taxonomies .checkbox' ).filter( function () {
341
  return !$( this ).hasClass( 'hidden' );
342
  } ).length === 0 ) {
343
+ // Toggle hide
344
+ $no_taxonomy.removeClass( 'hidden' );
345
+ $no_taxonomy.next( '.text-muted' ).addClass( 'hidden' );
346
+ $taxonomy_other_settings.addClass( 'hidden' );
347
  }
348
 
349
  // Trigger custom actions
350
  $( '.pt-wrap' ).trigger( 'content-type-change', [ this_val ] );
351
  };
352
 
 
353
  var content_type = '[name="' + _prefix + 'content-type' + '"]';
354
 
355
  // Run on page load
481
  */
482
  _thumbnail_settings: function () {
483
  var _prefix = this.options._prefix;
 
484
 
485
  /**
486
  * Toggle 'Thumbnail settings' when change 'Layout format'
489
  * @returns void
490
  */
491
  var fn_thumbnail_setting = function ( this_val ) {
492
+ var $show_thumbnail = $( '[name="' + _prefix + 'show-field-thumbnail' + '"]' );
493
 
494
+ // Force to show thumbnail IF it is not enabled
495
+ if ( this_val === '2-col' && !$show_thumbnail.is( ':checked' ) ) {
496
+ $show_thumbnail.trigger( 'click' );
 
 
 
 
 
 
 
497
  }
498
  };
499
 
admin/content-views-admin.php CHANGED
@@ -162,9 +162,9 @@ class PT_Content_Views_Admin {
162
 
163
  // Load every Admin pages
164
  PT_CV_Asset::enqueue(
165
- 'admin-menu', 'style', array(
166
  'src' => plugins_url( 'assets/css/menu.css', __FILE__ ),
167
- )
168
  );
169
 
170
  $screen = get_current_screen();
@@ -177,34 +177,34 @@ class PT_Content_Views_Admin {
177
 
178
  // Main admin style
179
  PT_CV_Asset::enqueue(
180
- 'admin', 'style', array(
181
  'src' => plugins_url( 'assets/css/admin.css', __FILE__ ),
182
- )
183
  );
184
 
185
  // Fix style of WP
186
  global $wp_version;
187
  if ( version_compare( $wp_version, '3.8.0' ) >= 0 ) {
188
  PT_CV_Asset::enqueue(
189
- 'admin-fix', 'style', array(
190
  'src' => plugins_url( 'assets/css/wp38.css', __FILE__ ),
191
  'ver' => $wp_version,
192
- )
193
  );
194
  } else {
195
  PT_CV_Asset::enqueue(
196
- 'admin-fix', 'style', array(
197
  'src' => plugins_url( 'assets/css/wp.css', __FILE__ ),
198
  'ver' => $wp_version,
199
- )
200
  );
201
  }
202
 
203
  // Bootstrap for Admin
204
  PT_CV_Asset::enqueue(
205
- 'bootstrap-admin', 'style', array(
206
  'src' => plugins_url( 'assets/bootstrap/css/bootstrap.full.css', PT_CV_FILE ),
207
- )
208
  );
209
 
210
  // For Preview
@@ -238,15 +238,15 @@ class PT_Content_Views_Admin {
238
 
239
  // Main admin script
240
  PT_CV_Asset::enqueue(
241
- 'admin', 'script', array(
242
  'src' => plugins_url( 'assets/js/admin.js', __FILE__ ),
243
  'deps' => array( 'jquery' ),
244
- )
245
  );
246
 
247
  // Localize strings
248
  PT_CV_Asset::localize_script(
249
- 'admin', PT_CV_PREFIX_UPPER . 'ADMIN', array(
250
  'supported_version' => PT_CV_Functions::wp_version_compare( '3.5' ),
251
  'text' => array(
252
  'no_taxonomy' => __( 'There is no taxonomy for selected content type', PT_CV_TEXTDOMAIN ),
@@ -263,7 +263,7 @@ class PT_Content_Views_Admin {
263
  'data' => array(
264
  'post_types_vs_taxonomies' => PT_CV_Values::post_types_vs_taxonomies(),
265
  ),
266
- )
267
  );
268
 
269
  // For Preview
@@ -297,22 +297,22 @@ class PT_Content_Views_Admin {
297
  * Add a settings page for this plugin to the Settings menu.
298
  */
299
  // Get user role settings option
300
- $user_role = current_user_can( 'administrator' ) ? 'administrator' : PT_CV_Functions::get_option_value( 'access_role', 'edit_posts' );
301
 
302
  $this->plugin_screen_hook_suffix = add_menu_page(
303
- __( 'Content Views Settings', PT_CV_TEXTDOMAIN ), __( 'Content Views', PT_CV_TEXTDOMAIN ), $user_role, $this->plugin_slug, array( $this, 'display_plugin_admin_page' ), '', '45.6'
304
  );
305
 
306
  $this->plugin_sub_screen_hook_suffix[] = PT_CV_Functions::menu_add_sub(
307
- $this->plugin_slug, __( 'All Content Views', PT_CV_TEXTDOMAIN ), __( 'All Views', PT_CV_TEXTDOMAIN ), $user_role, 'list', __CLASS__
308
  );
309
 
310
  $this->plugin_sub_screen_hook_suffix[] = PT_CV_Functions::menu_add_sub(
311
- $this->plugin_slug, __( 'Add New View', PT_CV_TEXTDOMAIN ), __( 'Add New', PT_CV_TEXTDOMAIN ), $user_role, 'add', __CLASS__
312
  );
313
 
314
  $this->plugin_sub_screen_hook_suffix[] = add_submenu_page(
315
- $this->plugin_slug, __( 'Content Views Settings', PT_CV_TEXTDOMAIN ), __( 'Settings', PT_CV_TEXTDOMAIN ), $user_role, $this->plugin_slug, array( $this, 'display_plugin_admin_page' )
316
  );
317
 
318
  global $submenu;
@@ -320,6 +320,7 @@ class PT_Content_Views_Admin {
320
  if ( !empty( $submenu[ 'content-views' ][ 1 ][ 2 ] ) ) {
321
  $submenu[ 'content-views' ][ 1 ][ 2 ] = 'edit.php?post_type=pt_view';
322
  }
 
323
  // Remove first submenu which is similar to parent menu
324
  unset( $submenu[ 'content-views' ][ 0 ] );
325
  }
@@ -335,7 +336,7 @@ class PT_Content_Views_Admin {
335
  // Get View id
336
  $view_id = get_post_meta( $post_id, PT_CV_META_ID, true );
337
 
338
- printf( '<input style="width: 250px; background: #ADFFAD;" type="text" value="[pt_view id=&quot;%s&quot;]" onclick="this.select()" readonly="">', $view_id );
339
  }
340
  }
341
 
@@ -363,10 +364,10 @@ class PT_Content_Views_Admin {
363
  public function filter_add_action_links( $links ) {
364
 
365
  return array_merge(
366
- array(
367
  'settings' => '<a href="' . admin_url( 'admin.php?page=' . $this->plugin_slug ) . '">' . __( 'Settings', PT_CV_TEXTDOMAIN ) . '</a>',
368
  'add' => '<a href="' . admin_url( 'admin.php?page=' . $this->plugin_slug . '-add' ) . '">' . __( 'Add View', PT_CV_TEXTDOMAIN ) . '</a>',
369
- ), $links
370
  );
371
  }
372
 
162
 
163
  // Load every Admin pages
164
  PT_CV_Asset::enqueue(
165
+ 'admin-menu', 'style', array(
166
  'src' => plugins_url( 'assets/css/menu.css', __FILE__ ),
167
+ )
168
  );
169
 
170
  $screen = get_current_screen();
177
 
178
  // Main admin style
179
  PT_CV_Asset::enqueue(
180
+ 'admin', 'style', array(
181
  'src' => plugins_url( 'assets/css/admin.css', __FILE__ ),
182
+ )
183
  );
184
 
185
  // Fix style of WP
186
  global $wp_version;
187
  if ( version_compare( $wp_version, '3.8.0' ) >= 0 ) {
188
  PT_CV_Asset::enqueue(
189
+ 'admin-fix', 'style', array(
190
  'src' => plugins_url( 'assets/css/wp38.css', __FILE__ ),
191
  'ver' => $wp_version,
192
+ )
193
  );
194
  } else {
195
  PT_CV_Asset::enqueue(
196
+ 'admin-fix', 'style', array(
197
  'src' => plugins_url( 'assets/css/wp.css', __FILE__ ),
198
  'ver' => $wp_version,
199
+ )
200
  );
201
  }
202
 
203
  // Bootstrap for Admin
204
  PT_CV_Asset::enqueue(
205
+ 'bootstrap-admin', 'style', array(
206
  'src' => plugins_url( 'assets/bootstrap/css/bootstrap.full.css', PT_CV_FILE ),
207
+ )
208
  );
209
 
210
  // For Preview
238
 
239
  // Main admin script
240
  PT_CV_Asset::enqueue(
241
+ 'admin', 'script', array(
242
  'src' => plugins_url( 'assets/js/admin.js', __FILE__ ),
243
  'deps' => array( 'jquery' ),
244
+ )
245
  );
246
 
247
  // Localize strings
248
  PT_CV_Asset::localize_script(
249
+ 'admin', PT_CV_PREFIX_UPPER . 'ADMIN', array(
250
  'supported_version' => PT_CV_Functions::wp_version_compare( '3.5' ),
251
  'text' => array(
252
  'no_taxonomy' => __( 'There is no taxonomy for selected content type', PT_CV_TEXTDOMAIN ),
263
  'data' => array(
264
  'post_types_vs_taxonomies' => PT_CV_Values::post_types_vs_taxonomies(),
265
  ),
266
+ )
267
  );
268
 
269
  // For Preview
297
  * Add a settings page for this plugin to the Settings menu.
298
  */
299
  // Get user role settings option
300
+ $user_role = current_user_can( 'administrator' ) ? 'administrator' : PT_CV_Functions::get_option_value( 'access_role', 'administrator' );
301
 
302
  $this->plugin_screen_hook_suffix = add_menu_page(
303
+ __( 'Content Views Settings', PT_CV_TEXTDOMAIN ), __( 'Content Views', PT_CV_TEXTDOMAIN ), $user_role, $this->plugin_slug, array( $this, 'display_plugin_admin_page' ), '', '45.6'
304
  );
305
 
306
  $this->plugin_sub_screen_hook_suffix[] = PT_CV_Functions::menu_add_sub(
307
+ $this->plugin_slug, __( 'All Content Views', PT_CV_TEXTDOMAIN ), __( 'All Views', PT_CV_TEXTDOMAIN ), $user_role, 'list', __CLASS__
308
  );
309
 
310
  $this->plugin_sub_screen_hook_suffix[] = PT_CV_Functions::menu_add_sub(
311
+ $this->plugin_slug, __( 'Add New View', PT_CV_TEXTDOMAIN ), __( 'Add New', PT_CV_TEXTDOMAIN ), $user_role, 'add', __CLASS__
312
  );
313
 
314
  $this->plugin_sub_screen_hook_suffix[] = add_submenu_page(
315
+ $this->plugin_slug, __( 'Content Views Settings', PT_CV_TEXTDOMAIN ), __( 'Settings', PT_CV_TEXTDOMAIN ), $user_role, $this->plugin_slug, array( $this, 'display_plugin_admin_page' )
316
  );
317
 
318
  global $submenu;
320
  if ( !empty( $submenu[ 'content-views' ][ 1 ][ 2 ] ) ) {
321
  $submenu[ 'content-views' ][ 1 ][ 2 ] = 'edit.php?post_type=pt_view';
322
  }
323
+
324
  // Remove first submenu which is similar to parent menu
325
  unset( $submenu[ 'content-views' ][ 0 ] );
326
  }
336
  // Get View id
337
  $view_id = get_post_meta( $post_id, PT_CV_META_ID, true );
338
 
339
+ printf( '<input style="width: 200px; background: #ADFFAD;" type="text" value="[pt_view id=&quot;%s&quot;]" onclick="this.select()" readonly="">', $view_id );
340
  }
341
  }
342
 
364
  public function filter_add_action_links( $links ) {
365
 
366
  return array_merge(
367
+ array(
368
  'settings' => '<a href="' . admin_url( 'admin.php?page=' . $this->plugin_slug ) . '">' . __( 'Settings', PT_CV_TEXTDOMAIN ) . '</a>',
369
  'add' => '<a href="' . admin_url( 'admin.php?page=' . $this->plugin_slug . '-add' ) . '">' . __( 'Add View', PT_CV_TEXTDOMAIN ) . '</a>',
370
+ ), $links
371
  );
372
  }
373
 
admin/includes/options.php CHANGED
@@ -197,13 +197,15 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
197
  $min = !empty( $param[ 'min' ] ) ? intval( $param[ 'min' ] ) : 0;
198
  $extend = 'min="' . $min . '"';
199
  break;
 
200
  case 'color':
201
  $class .= ' ' . PT_CV_PREFIX . 'color';
202
  break;
 
203
  case 'checkbox':
204
  case 'radio':
205
  // Remove form-control class in checkbox, radio
206
- $class = str_replace( 'form-control', '', $class );
207
  break;
208
  }
209
 
@@ -214,28 +216,34 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
214
  case 'group':
215
  $html .= self::do_settings( $param[ 'params' ], $data );
216
  break;
 
217
  case 'text':
218
  case 'email':
219
  case 'password':
220
  case 'number':
221
  case 'url':
222
- $placeholder = !empty( $param[ 'placeholder' ] ) ? $param[ 'placeholder' ] : '';
223
- $append_text = !empty( $param[ 'append_text' ] ) ? $param[ 'append_text' ] : '';
 
224
 
225
  $input = "<input type='$type' name='$name' value='$value' class='$class' $id $extend placeholder='$placeholder'>";
226
- if ( empty( $append_text ) ) {
227
- $html .= $input;
228
- } else {
229
- $html .= "<div class='input-group'>$input<span class='input-group-addon'>$append_text</span></div>";
230
  }
 
 
231
  break;
 
232
  case 'color':
233
  $html .= "<input type='text' name='$name' value='$value' class='$class' $id $extend style='background-color:$value;'>";
234
  $html .= "<div class='" . PT_CV_PREFIX . "colorpicker' style='z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;'></div><br>";
235
  break;
 
236
  case 'textarea':
237
  $html .= "<textarea name='$name' class='$class' $id $extend>$value</textarea>";
238
  break;
 
239
  case 'checkbox':
240
  case 'radio':
241
  if ( !isset( $param[ 'options' ] ) ) {
@@ -260,6 +268,7 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
260
  }
261
 
262
  break;
 
263
  case 'select':
264
  if ( !isset( $param[ 'options' ] ) ) {
265
  break;
@@ -271,7 +280,7 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
271
 
272
  $options = '';
273
  foreach ( $param[ 'options' ] as $key => $text ) {
274
- $selected = ( in_array( $key, (array) $value ) || ( $value == 'all' ) ) ? 'selected' : '';
275
  $option_class = isset( $param[ 'option_class_prefix' ] ) ? sprintf( "class='%s'", $param[ 'option_class_prefix' ] . esc_attr( sanitize_title( $key ) ) ) : '';
276
  $options .= "<option value='$key' $selected $option_class>$text</option>";
277
  }
@@ -287,14 +296,17 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
287
  $html .= "<select name='$name' class='$class' $multiple $id $extend>$options</select>";
288
  }
289
  break;
 
290
  case 'color_picker':
291
  $html .= self::field_type( $param[ 'options' ], $data );
292
  break;
 
293
  case 'html':
294
  if ( isset( $param[ 'content' ] ) ) {
295
  $html .= $param[ 'content' ];
296
  }
297
  break;
 
298
  case 'panel_group':
299
  // In format: key => array of params
300
  $parent_id = PT_CV_Functions::string_random( true );
@@ -303,8 +315,6 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
303
  $html .= self::sub_panel_group( $key, $param_group, $data, $parent_id, $settings );
304
  }
305
  break;
306
- default:
307
- break;
308
  }
309
 
310
  $description = apply_filters( PT_CV_PREFIX_ . 'options_description', $description, $param );
197
  $min = !empty( $param[ 'min' ] ) ? intval( $param[ 'min' ] ) : 0;
198
  $extend = 'min="' . $min . '"';
199
  break;
200
+
201
  case 'color':
202
  $class .= ' ' . PT_CV_PREFIX . 'color';
203
  break;
204
+
205
  case 'checkbox':
206
  case 'radio':
207
  // Remove form-control class in checkbox, radio
208
+ $class = str_replace( 'form-control', '', $class );
209
  break;
210
  }
211
 
216
  case 'group':
217
  $html .= self::do_settings( $param[ 'params' ], $data );
218
  break;
219
+
220
  case 'text':
221
  case 'email':
222
  case 'password':
223
  case 'number':
224
  case 'url':
225
+ $placeholder = !empty( $param[ 'placeholder' ] ) ? $param[ 'placeholder' ] : '';
226
+ $prepend_text = !empty( $param[ 'prepend_text' ] ) ? $param[ 'prepend_text' ] : '';
227
+ $append_text = !empty( $param[ 'append_text' ] ) ? $param[ 'append_text' ] : '';
228
 
229
  $input = "<input type='$type' name='$name' value='$value' class='$class' $id $extend placeholder='$placeholder'>";
230
+
231
+ if ( !empty( $prepend_text ) || !empty( $append_text ) ) {
232
+ $input = "<div class='input-group'>{$prepend_text}{$input}<span class='input-group-addon'>{$append_text}</span></div>";
 
233
  }
234
+
235
+ $html .= $input;
236
  break;
237
+
238
  case 'color':
239
  $html .= "<input type='text' name='$name' value='$value' class='$class' $id $extend style='background-color:$value;'>";
240
  $html .= "<div class='" . PT_CV_PREFIX . "colorpicker' style='z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;'></div><br>";
241
  break;
242
+
243
  case 'textarea':
244
  $html .= "<textarea name='$name' class='$class' $id $extend>$value</textarea>";
245
  break;
246
+
247
  case 'checkbox':
248
  case 'radio':
249
  if ( !isset( $param[ 'options' ] ) ) {
268
  }
269
 
270
  break;
271
+
272
  case 'select':
273
  if ( !isset( $param[ 'options' ] ) ) {
274
  break;
280
 
281
  $options = '';
282
  foreach ( $param[ 'options' ] as $key => $text ) {
283
+ $selected = ( in_array( str_replace( '&amp;', '&', $key ), (array) $value ) || ( $value == 'all' ) ) ? 'selected' : '';
284
  $option_class = isset( $param[ 'option_class_prefix' ] ) ? sprintf( "class='%s'", $param[ 'option_class_prefix' ] . esc_attr( sanitize_title( $key ) ) ) : '';
285
  $options .= "<option value='$key' $selected $option_class>$text</option>";
286
  }
296
  $html .= "<select name='$name' class='$class' $multiple $id $extend>$options</select>";
297
  }
298
  break;
299
+
300
  case 'color_picker':
301
  $html .= self::field_type( $param[ 'options' ], $data );
302
  break;
303
+
304
  case 'html':
305
  if ( isset( $param[ 'content' ] ) ) {
306
  $html .= $param[ 'content' ];
307
  }
308
  break;
309
+
310
  case 'panel_group':
311
  // In format: key => array of params
312
  $parent_id = PT_CV_Functions::string_random( true );
315
  $html .= self::sub_panel_group( $key, $param_group, $data, $parent_id, $settings );
316
  }
317
  break;
 
 
318
  }
319
 
320
  $description = apply_filters( PT_CV_PREFIX_ . 'options_description', $description, $param );
admin/includes/plugin.php CHANGED
@@ -166,7 +166,7 @@ if ( !class_exists( 'PT_CV_Plugin' ) ) {
166
  $field_name = 'unload_bootstrap';
167
 
168
  self::_field_print(
169
- $field_name, 'checkbox', __( "Don't load <b>Bootstrap 3</b> style & script (in frontend of website)", PT_CV_TEXTDOMAIN ), __( 'Only tick this option if Bootstrap has been loaded by active theme or other plugins', PT_CV_TEXTDOMAIN )
170
  );
171
  }
172
 
@@ -193,7 +193,7 @@ if ( !class_exists( 'PT_CV_Plugin' ) ) {
193
  $field_id = esc_attr( $field_name );
194
 
195
  printf(
196
- '<input type="%1$s" id="%2$s" name="%3$s[%2$s]" value="%4$s" %5$s /> ', esc_attr( $field_type ), $field_id, PT_CV_OPTION_NAME, $field_value, $checked
197
  );
198
 
199
  // For radio, checkbox field
166
  $field_name = 'unload_bootstrap';
167
 
168
  self::_field_print(
169
+ $field_name, 'checkbox', __( "Don't load <b>Bootstrap 3</b> style & script (in frontend of website)", PT_CV_TEXTDOMAIN ), __( 'Only check this option if Bootstrap has been loaded by active theme or another plugin', PT_CV_TEXTDOMAIN )
170
  );
171
  }
172
 
193
  $field_id = esc_attr( $field_name );
194
 
195
  printf(
196
+ '<input type="%1$s" id="%2$s" name="%3$s[%2$s]" value="%4$s" %5$s /> ', esc_attr( $field_type ), $field_id, PT_CV_OPTION_NAME, $field_value, $checked
197
  );
198
 
199
  // For radio, checkbox field
admin/includes/templates/settings-section-one.php CHANGED
@@ -1,10 +1,2 @@
1
- <p><br>Thank you for using Content Views!</p>
2
- <p>You are using
3
- <strong>Free</strong> version: <?php echo esc_html( PT_CV_Functions::plugin_info( PT_CV_FILE, 'Version' ) ); ?></p>
4
- <p>
5
- By default, any user who has <strong>edit_posts</strong> capability (Administrator, Editor, Author, Contributor) can manage all Views (add, edit, delete).<br>
6
- To restrict which user role can manage Views,
7
- <?php
8
- echo sprintf( ' <a href="%s" target="_blank">%s</a>', esc_url( 'http://www.contentviewspro.com/pricing/?utm_source=settings_page&utm_medium=role' ), __( 'Get CVPro now!', PT_CV_TEXTDOMAIN ) );
9
- ?>
10
- </p>
1
+ <p><br>Thank you for using Content Views.</p>
2
+ <p>You are using version <code><?php echo esc_html( PT_CV_Functions::plugin_info( PT_CV_FILE, 'Version' ) ); ?></code></p>
 
 
 
 
 
 
 
 
admin/includes/templates/settings-section-two.php CHANGED
@@ -25,12 +25,13 @@
25
  </div>
26
 
27
  <div class="col-md-6">
28
- <h3>Custom post types & Custom fields</h3>
29
  <div>
30
- <p>Content Views Pro allows you to filter & display:<br>
31
- + any custom post types (WooCommerce, Easy Digital Downloads...)<br>
32
- + any custom fields (Advanced Custom Fields...)
33
- </p>
 
34
  </div>
35
  </div>
36
  </div>
@@ -45,6 +46,4 @@
45
 
46
  <hr>
47
 
48
- <p>I hope you enjoy with Content Views!</p>
49
- <p>Plugin developed by PT Guy (support@contentviewspro.com)</p>
50
- <p>Copyright &COPY; 2014</p>
25
  </div>
26
 
27
  <div class="col-md-6">
28
+ <h3>More powerful settings</h3>
29
  <div>
30
+ <ul style="list-style: circle; margin-left: 20px;">
31
+ <li>any custom post types (WooCommerce, Easy Digital Downloads...)</li>
32
+ <li>any custom fields (Advanced Custom Fields...)</li>
33
+ <li>any custom taxonomies</li>
34
+ </ul>
35
  </div>
36
  </div>
37
  </div>
46
 
47
  <hr>
48
 
49
+ <p><a href="http://www.contentviewspro.com/contact/">Contact us!</a></p>
 
 
admin/views/view.php CHANGED
@@ -65,7 +65,7 @@ PT_CV_Functions::view_submit();
65
  'type' => 'html',
66
  'name' => 'preview',
67
  'content' => PT_CV_Html::html_preview_box(),
68
- 'desc' => __( 'Click <strong>Show Preview</strong> or <strong>Update Preview</strong> button to show, <strong>Hide Preview</strong> button to hide the output', PT_CV_TEXTDOMAIN ),
69
  ),
70
  ),
71
  ),
@@ -153,7 +153,7 @@ PT_CV_Functions::view_submit();
153
  ),
154
  ),
155
  // Upgrade to Pro: Custom post type
156
- !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter custom post type (product, event...) ?', PT_CV_TEXTDOMAIN ), 10 ) : '',
157
  apply_filters( PT_CV_PREFIX_ . 'custom_filters', array() ),
158
  // Common Filters
159
  array(
@@ -180,24 +180,25 @@ PT_CV_Functions::view_submit();
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
  ),
187
  apply_filters( PT_CV_PREFIX_ . 'include_extra_settings', array() ),
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
  ),
202
  apply_filters( PT_CV_PREFIX_ . 'exclude_extra_settings', array() ),
203
  // Parent page
@@ -210,7 +211,7 @@ PT_CV_Functions::view_submit();
210
  'type' => 'number',
211
  'name' => 'post_parent',
212
  'std' => '',
213
- 'desc' => __( 'Enter ID of parent page to query child pages', PT_CV_TEXTDOMAIN ),
214
  ),
215
  ),
216
  'dependence' => array( 'content-type', 'page' ),
@@ -227,7 +228,7 @@ PT_CV_Functions::view_submit();
227
  'name' => 'limit',
228
  'std' => '10',
229
  'min' => '1',
230
- 'desc' => __( 'The number of posts to show. Set empty to show all found posts (which match all filter settings)', PT_CV_TEXTDOMAIN ),
231
  ),
232
  ),
233
  ),
@@ -309,12 +310,12 @@ PT_CV_Functions::view_submit();
309
  'options' => PT_CV_Values::taxonomy_list(),
310
  'std' => '',
311
  'class' => 'taxonomy-item',
312
- 'desc' => __( 'Tick checkbox of taxonomies to filter posts by their terms', PT_CV_TEXTDOMAIN ),
313
  ),
314
  ),
315
  ),
316
  // Upgrade to Pro: Custom taxonomy
317
- !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter by custom taxonomies ?', PT_CV_TEXTDOMAIN ), 10 ) : '',
318
  // Terms list
319
  array(
320
  'label' => array(
@@ -348,7 +349,6 @@ PT_CV_Functions::view_submit();
348
  'options' => PT_CV_Values::taxonomy_relation(),
349
  'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::taxonomy_relation() ),
350
  'class' => 'taxonomy-relation',
351
- 'desc' => __( 'Select AND to show posts which match ALL settings of selected taxonomies.<br>Select OR to show posts which match settings of at least one selected taxonomy', PT_CV_TEXTDOMAIN ),
352
  ),
353
  ),
354
  ),
@@ -394,7 +394,7 @@ PT_CV_Functions::view_submit();
394
  ),
395
  ),
396
  $version_gt_37 ?
397
- array(
398
  'label' => array(
399
  'text' => __( 'Not written by', PT_CV_TEXTDOMAIN ),
400
  ),
@@ -408,7 +408,7 @@ PT_CV_Functions::view_submit();
408
  'multiple' => $version_gt_37 ? '1' : '0',
409
  ),
410
  ),
411
- ) : array(),
412
  ) ), // End Author Settings
413
  // Status Settings
414
  'status' => array(
@@ -424,7 +424,6 @@ PT_CV_Functions::view_submit();
424
  'std' => 'publish',
425
  'class' => 'select2',
426
  'multiple' => '1',
427
- 'desc' => __( 'Select status of posts', PT_CV_TEXTDOMAIN ),
428
  ),
429
  ),
430
  ),
@@ -445,7 +444,7 @@ PT_CV_Functions::view_submit();
445
  ),
446
  ),
447
  ), // End Keyword Settings
448
- )
449
  ),
450
  ),
451
  ),
@@ -520,7 +519,6 @@ PT_CV_Functions::view_submit();
520
  'name' => 'layout-format',
521
  'options' => PT_CV_Values::layout_format(),
522
  'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::layout_format() ),
523
- 'desc' => __( 'This is layout format of output for each post', PT_CV_TEXTDOMAIN ),
524
  ),
525
  ),
526
  ),
65
  'type' => 'html',
66
  'name' => 'preview',
67
  'content' => PT_CV_Html::html_preview_box(),
68
+ 'desc' => __( 'To show output, please click <code>Show Preview</code> or <code>Update Preview</code> button. Otherwise, please click <code>Hide Preview</code> button', PT_CV_TEXTDOMAIN ),
69
  ),
70
  ),
71
  ),
153
  ),
154
  ),
155
  // Upgrade to Pro: Custom post type
156
+ !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter custom post type (product, event...) ?', PT_CV_TEXTDOMAIN ) ) : '',
157
  apply_filters( PT_CV_PREFIX_ . 'custom_filters', array() ),
158
  // Common Filters
159
  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 show (comma-separated values, for example: 1,2,3)', PT_CV_TEXTDOMAIN ) ),
184
  ),
185
  ),
186
  ),
187
  apply_filters( PT_CV_PREFIX_ . 'include_extra_settings', array() ),
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, for example: 1,2,3)', PT_CV_TEXTDOMAIN ) ),
199
  ),
200
  ),
201
+ 'dependence' => array( 'post__in', '' ),
202
  ),
203
  apply_filters( PT_CV_PREFIX_ . 'exclude_extra_settings', array() ),
204
  // Parent page
211
  'type' => 'number',
212
  'name' => 'post_parent',
213
  'std' => '',
214
+ 'desc' => __( 'Enter ID of parent page to get child pages', PT_CV_TEXTDOMAIN ),
215
  ),
216
  ),
217
  'dependence' => array( 'content-type', 'page' ),
228
  'name' => 'limit',
229
  'std' => '10',
230
  'min' => '1',
231
+ 'desc' => __( 'The number of posts to show. Set empty to show all found posts', PT_CV_TEXTDOMAIN ),
232
  ),
233
  ),
234
  ),
310
  'options' => PT_CV_Values::taxonomy_list(),
311
  'std' => '',
312
  'class' => 'taxonomy-item',
313
+ 'desc' => __( 'Check the boxes to show settings', PT_CV_TEXTDOMAIN ),
314
  ),
315
  ),
316
  ),
317
  // Upgrade to Pro: Custom taxonomy
318
+ !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter by custom taxonomies ?', PT_CV_TEXTDOMAIN ) ) : '',
319
  // Terms list
320
  array(
321
  'label' => array(
349
  'options' => PT_CV_Values::taxonomy_relation(),
350
  'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::taxonomy_relation() ),
351
  'class' => 'taxonomy-relation',
 
352
  ),
353
  ),
354
  ),
394
  ),
395
  ),
396
  $version_gt_37 ?
397
+ array(
398
  'label' => array(
399
  'text' => __( 'Not written by', PT_CV_TEXTDOMAIN ),
400
  ),
408
  'multiple' => $version_gt_37 ? '1' : '0',
409
  ),
410
  ),
411
+ ) : array(),
412
  ) ), // End Author Settings
413
  // Status Settings
414
  'status' => array(
424
  'std' => 'publish',
425
  'class' => 'select2',
426
  'multiple' => '1',
 
427
  ),
428
  ),
429
  ),
444
  ),
445
  ),
446
  ), // End Keyword Settings
447
+ )
448
  ),
449
  ),
450
  ),
519
  'name' => 'layout-format',
520
  'options' => PT_CV_Values::layout_format(),
521
  'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::layout_format() ),
 
522
  ),
523
  ),
524
  ),
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.5
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.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.7.6
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.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
@@ -118,7 +118,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
118
  */
119
  static function menu_add_sub( $parent_slug, $page_title, $menu_title, $user_role, $sub_page, $class ) {
120
  return add_submenu_page(
121
- $parent_slug, $page_title, $menu_title, $user_role, $parent_slug . '-' . $sub_page, array( $class, 'display_sub_page_' . $sub_page )
122
  );
123
  }
124
 
@@ -515,12 +515,12 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
515
 
516
  // Query view which has view id = $meta_id
517
  $pt_query = new WP_Query(
518
- array(
519
  'post_type' => PT_CV_POST_TYPE,
520
  'post_status' => 'publish',
521
  'meta_key' => PT_CV_META_ID,
522
  'meta_value' => esc_sql( $meta_id ),
523
- )
524
  );
525
  if ( $pt_query->have_posts() ) :
526
  while ( $pt_query->have_posts() ):
@@ -572,54 +572,14 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
572
  return;
573
  }
574
 
575
- $post_id = apply_filters( PT_CV_PREFIX_ . 'view_get_post_id', PT_CV_Functions::post_id_from_meta_id( $meta_id ), $meta_id );
 
576
 
577
- // Get view settings
578
  if ( $post_id ) {
579
  $view_settings = get_post_meta( $post_id, PT_CV_META_SETTINGS, true );
580
-
581
- /* Backward compatibility
582
- * since 1.3.2
583
- */
584
- $trans_name = PT_CV_PREFIX . 'compatible-' . $post_id;
585
- $trans = get_transient( $trans_name );
586
- if ( empty( $trans ) ) {
587
- self::view_backward_comp( $view_settings );
588
- set_transient( $trans_name, 1, 10 * YEAR_IN_SECONDS );
589
- }
590
-
591
- return is_array( $view_settings ) ? $view_settings : array();
592
- }
593
-
594
- return array();
595
- }
596
-
597
- /**
598
- * Update values for some new options in new version (from options in old version)
599
- *
600
- * @param type $view_settings
601
- */
602
- static function view_backward_comp( &$view_settings ) {
603
- if ( !$view_settings ) {
604
- return $view_settings;
605
- }
606
-
607
- // Taxonomy In, Not in
608
- $taxonomies = isset( $view_settings[ PT_CV_PREFIX . 'taxonomy' ] ) ? $view_settings[ PT_CV_PREFIX . 'taxonomy' ] : array();
609
- if ( is_array( $taxonomies ) ) {
610
- $list = array( '__in', '__not_in' );
611
- foreach ( $taxonomies as $taxonomy ) {
612
- // Check if IN/NOT IN list has values. NOT IN list will overwite IN list
613
- foreach ( $list as $ltype ) {
614
- if ( isset( $view_settings[ PT_CV_PREFIX . $taxonomy . $ltype ] ) ) {
615
- $view_settings[ PT_CV_PREFIX . $taxonomy . '-terms' ] = $view_settings[ PT_CV_PREFIX . $taxonomy . $ltype ];
616
- $view_settings[ PT_CV_PREFIX . $taxonomy . '-operator' ] = ( $ltype == '__in' ) ? 'IN' : 'NOT IN';
617
- }
618
- }
619
- }
620
  }
621
 
622
- $view_settings = apply_filters( PT_CV_PREFIX_ . 'backward_comp', $view_settings );
623
  }
624
 
625
  /**
@@ -636,76 +596,50 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
636
  return __( 'Empty settings', PT_CV_TEXTDOMAIN );
637
  }
638
 
 
 
 
 
 
 
 
639
  global $pt_cv_glb, $pt_cv_id;
640
- if ( !is_array( $pt_cv_glb ) )
641
  $pt_cv_glb = array();
642
- if ( !isset( $pt_cv_glb ) )
643
  $pt_cv_id = 0;
644
-
645
- $view_id = !empty( $id ) ? $id : PT_CV_Functions::string_random();
646
-
647
- // Init arrays
648
  if ( !isset( $pt_cv_glb[ $view_id ] ) ) {
649
  $pt_cv_glb[ $view_id ] = array();
650
  }
651
- if ( !isset( $pt_cv_glb[ 'processed_view' ] ) ) {
652
- $pt_cv_glb[ 'processed_view' ] = array();
653
- }
654
 
655
- /**
656
- * 1. Get View settings
657
- */
658
  $view_settings = array();
659
  foreach ( $settings as $key => $value ) {
660
  $view_settings[ $key ] = esc_sql( $value );
661
  }
662
  $pt_cv_glb[ $view_id ][ 'view_settings' ] = $view_settings;
663
 
664
- // Check duplicated View
665
- // (Same View ID but different shortcode parameters => consider as 2 different Views)
666
- if ( empty( $pargs ) && apply_filters( PT_CV_PREFIX_ . 'check_duplicate', 0, $view_id, $view_settings ) ) {
667
- $sc_params = isset( $pt_cv_glb[ $view_id ][ 'shortcode_params' ] ) ? $pt_cv_glb[ $view_id ][ 'shortcode_params' ] : PT_CV_Functions::string_random();
668
- $vid = $view_id . '-' . md5( serialize( $sc_params ) );
669
- if ( !empty( $pt_cv_glb[ 'processed_view' ][ $vid ] ) ) {
670
- return '';
671
- } else {
672
- $pt_cv_glb[ 'processed_view' ][ $vid ] = 1;
673
- }
674
- }
675
 
676
- // Get content type
677
- $content_type = apply_filters( PT_CV_PREFIX_ . 'content_type', PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $view_settings ), $id );
678
  $pt_cv_glb[ $view_id ][ 'content_type' ] = $content_type;
679
-
680
- // Get view type
681
- $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $view_settings );
682
  $pt_cv_glb[ $view_id ][ 'view_type' ] = $view_type;
683
 
684
- // Get session id, not empty if is pagination request
685
- $session_id = ( $pargs && isset( $pargs[ 'session_id' ] ) ) ? $pargs[ 'session_id' ] : 0;
686
-
687
- // Store main View ID
688
- // If parent View is not finished
689
- if ( !isset( $pt_cv_glb[ $pt_cv_id ][ 'finished' ] ) ) {
690
- $pt_cv_main_id = !empty( $pt_cv_id ) ? $pt_cv_id : $view_id;
691
- } else {
692
- $pt_cv_main_id = $view_id;
693
- }
694
 
695
- // If is pagination request
 
696
  if ( $session_id ) {
697
  if ( empty( $pt_cv_id ) ) {
698
  $pt_cv_id = $session_id;
699
  }
700
 
701
- $saved_settings = isset( $_SESSION[ PT_CV_PREFIX . 'view-data-' . $session_id ] ) ? $_SESSION[ PT_CV_PREFIX . 'view-data-' . $session_id ] : array();
702
-
703
- $session_data = array_merge(
704
- array( '$args' => '', '$dargs' => '' ), $saved_settings
705
- );
706
-
707
- $args = $session_data[ '$args' ];
708
- $dargs = $session_data[ '$dargs' ];
709
  } else {
710
  // Assign view id as current View
711
  $pt_cv_id = $session_id = $view_id;
@@ -716,8 +650,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
716
 
717
  // Extract Query & Display settings from settings array
718
  if ( empty( $args ) || empty( $dargs ) ) {
719
- $dargs = apply_filters( PT_CV_PREFIX_ . 'all_display_settings', PT_CV_Functions::view_display_settings( $view_type, $dargs ) );
720
- $args = apply_filters( PT_CV_PREFIX_ . 'query_parameters', PT_CV_Functions::view_filter_settings( $content_type, $view_settings ) );
721
 
722
  // Store view data
723
  $_SESSION[ PT_CV_PREFIX . 'view-data-' . $session_id ] = array(
@@ -729,6 +663,10 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
729
  // Pagination settings
730
  PT_CV_Functions::view_get_pagination_settings( $dargs, $args, $pargs );
731
 
 
 
 
 
732
  // Update global query parameters variable
733
  $pt_cv_glb[ $view_id ][ 'dargs' ] = $dargs;
734
  $pt_cv_glb[ $view_id ][ 'args' ] = $args;
@@ -736,43 +674,36 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
736
 
737
  // Validate settings, if some required parameters are missing, show error and exit
738
  $error = apply_filters( PT_CV_PREFIX_ . 'validate_settings', array(), $args );
739
-
740
- // Return error message
741
  if ( $error ) {
742
  return ( implode( '</p><p>', $error ) );
743
  }
744
 
745
- /**
746
- * 2. Output Items
747
- */
748
  $content_items = $pt_query = $empty_result = null;
749
 
 
 
 
 
750
  // What kind of content to display
751
  $pt_cv_glb[ $view_id ][ 'display_what' ] = apply_filters( PT_CV_PREFIX_ . 'display_what', 'post' );
752
 
753
  if ( $pt_cv_glb[ $view_id ][ 'display_what' ] === 'post' ) {
754
- // Display posts
755
  extract( self::get_posts_list( $args, $view_type ) );
756
  } else {
757
- // Display categories...
758
  $content_items = apply_filters( PT_CV_PREFIX_ . 'view_content', array() );
759
  }
760
 
761
- // Restore main View id
762
- $pt_cv_id = $pt_cv_main_id;
763
 
764
- /**
765
- * 3. Output Pagination
766
- */
767
  if ( apply_filters( PT_CV_PREFIX_ . 'hide_empty_result', false ) && $empty_result ) {
768
- // Hide empty result
769
  $html = '';
770
  } else {
771
- $current_page = self::get_current_page( $pargs );
772
- $pt_cv_glb[ $pt_cv_id ][ 'current_page' ] = $current_page;
773
- $html = PT_CV_Html::content_items_wrap( $content_items, $current_page, $args[ 'posts_per_page' ], $view_id );
774
 
775
- // Append Pagination HTML if this is first page, or not Ajax calling
776
  if ( $pt_query && $args[ 'posts_per_page' ] > 0 && PT_CV_Functions::nonpaging_or_firstpage( $dargs, $current_page ) ) {
777
  // Total post founds
778
  $found_posts = apply_filters( PT_CV_PREFIX_ . 'found_posts', $pt_query->found_posts );
@@ -790,9 +721,6 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
790
  }
791
  }
792
 
793
- // Reset View ID
794
- $pt_cv_glb[ $pt_cv_id ][ 'finished' ] = 1;
795
-
796
  return $html;
797
  }
798
 
@@ -819,6 +747,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
819
  //print_r( $pt_query->request );
820
  // The Loop
821
  if ( $pt_query->have_posts() ) {
 
 
822
  $post_idx = 0;
823
  while ( $pt_query->have_posts() ) {
824
  $pt_query->the_post();
@@ -830,6 +760,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
830
  $content_items[ $post->ID ] = PT_CV_Html::view_type_output( $view_type, $post, $post_idx++ );
831
  }
832
  }
 
 
833
  } else {
834
  // Get no post found class
835
  $_class = apply_filters( PT_CV_PREFIX_ . 'content_no_post_found_class', 'alert alert-warning' );
@@ -936,10 +868,9 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
936
  * @param string $content_type The content type
937
  */
938
  static function view_get_advanced_settings( &$args, $content_type ) {
 
 
939
 
940
- $view_settings = PT_CV_Functions::get_global_variable( 'view_settings' );
941
-
942
- $advanced_settings = (array) PT_CV_Functions::setting_value( PT_CV_PREFIX . 'advanced-settings', $view_settings );
943
  if ( $advanced_settings ) {
944
  foreach ( $advanced_settings as $setting ) {
945
  switch ( $setting ) {
@@ -957,27 +888,27 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
957
  // Author in
958
  if ( !empty( $author_in[ 0 ] ) ) {
959
  $args = array_merge(
960
- $args, array(
961
  'author__in' => array_map( 'intval', $author_in ),
962
- )
963
  );
964
  }
965
 
966
  // Author not in
967
  if ( !empty( $author_not_in[ 0 ] ) ) {
968
  $args = array_merge(
969
- $args, array(
970
  'author__not_in' => array_map( 'intval', $author_not_in ),
971
- )
972
  );
973
  }
974
  } else {
975
  // Author = ID
976
  if ( !empty( $author_in[ 0 ] ) ) {
977
  $args = array_merge(
978
- $args, array(
979
  'author' => intval( $author_in[ 0 ] ),
980
- )
981
  );
982
  }
983
  }
@@ -988,9 +919,9 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
988
  case 'status':
989
  $status = PT_CV_Functions::string_to_array( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post_status', $view_settings, 'publish' ) );
990
  $args = array_merge(
991
- $args, array(
992
  'post_status' => apply_filters( PT_CV_PREFIX_ . 'post_status', $status ),
993
- )
994
  );
995
  break;
996
 
@@ -998,9 +929,9 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
998
  case 'search':
999
  if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 's', $view_settings ) ) {
1000
  $args = array_merge(
1001
- $args, array(
1002
  's' => PT_CV_Functions::setting_value( PT_CV_PREFIX . 's', $view_settings ),
1003
- )
1004
  );
1005
  }
1006
  break;
@@ -1020,14 +951,15 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1020
 
1021
  // Get Terms & criterias (In, Not in)
1022
  foreach ( $taxonomies as $taxonomy ) {
1023
- if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . $taxonomy . '-terms', $view_settings ) ) {
1024
- // Get operator
 
1025
  $operator = PT_CV_Functions::setting_value( PT_CV_PREFIX . $taxonomy . '-operator', $view_settings, 'IN' );
1026
 
1027
  $taxonomy_setting[] = array(
1028
  'taxonomy' => $taxonomy,
1029
  'field' => 'slug',
1030
- 'terms' => (array) PT_CV_Functions::setting_value( PT_CV_PREFIX . $taxonomy . '-terms', $view_settings ),
1031
  'operator' => $operator,
1032
  /*
1033
  * @since 1.7.2
@@ -1053,10 +985,10 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1053
  // Order
1054
  case 'order':
1055
  $order_settings = apply_filters(
1056
- PT_CV_PREFIX_ . 'order_setting', array(
1057
  'orderby' => PT_CV_Functions::setting_value( PT_CV_PREFIX . 'orderby', $view_settings ),
1058
  'order' => PT_CV_Functions::setting_value( PT_CV_PREFIX . 'order', $view_settings ),
1059
- )
1060
  );
1061
 
1062
  $args = array_merge( $args, $order_settings );
@@ -1086,7 +1018,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1086
  $dargs[ 'layout-format' ] = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'layout-format', $view_settings );
1087
 
1088
  /**
1089
- * Columns count & Rows count
1090
  */
1091
  $dargs[ 'number-columns' ] = apply_filters( PT_CV_PREFIX_ . 'item_per_row', PT_CV_Functions::setting_value( PT_CV_PREFIX . $view_type . '-' . 'number-columns', $view_settings, 1 ) );
1092
  $dargs[ 'number-rows' ] = PT_CV_Functions::setting_value( PT_CV_PREFIX . $view_type . '-' . 'number-rows', $view_settings, 1 );
@@ -1160,7 +1092,6 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1160
  * @param array $pargs The pagination settings array
1161
  */
1162
  static function view_get_pagination_settings( &$dargs, &$args, $pargs ) {
1163
-
1164
  $view_settings = PT_CV_Functions::get_global_variable( 'view_settings' );
1165
 
1166
  // Get Limit value
@@ -1198,10 +1129,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1198
  }
1199
  }
1200
 
1201
- $offset = apply_filters( PT_CV_PREFIX_ . 'settings_args_offset', $offset );
1202
-
1203
  // Set 'offset' parameter
1204
- $args[ 'offset' ] = $offset;
1205
  }
1206
 
1207
  /**
@@ -1274,33 +1203,16 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1274
  */
1275
  static function view_output( $atts ) {
1276
  $atts = shortcode_atts(
1277
- apply_filters(
1278
- PT_CV_PREFIX_ . 'shortcode_params', array(
1279
- 'id' => 0,
1280
- )
1281
- ), $atts
1282
  );
1283
 
1284
- // View meta id
1285
  $id = esc_sql( $atts[ 'id' ] );
1286
-
1287
  if ( !$id )
1288
  return 'No view ID';
1289
 
1290
- // View shortcode parameters
1291
- global $pt_cv_glb, $pt_cv_sub_id, $pt_cv_id;
1292
-
1293
- /**
1294
- * Prevent recursive queries by disabling View shortcode in child pages if parent View is not finished
1295
- * @since 1.6.8.4, 2.4
1296
- */
1297
- if ( apply_filters( PT_CV_PREFIX_ . 'disable_child_view', true ) && $pt_cv_id != 0 && !isset( $pt_cv_glb[ $pt_cv_id ][ 'finished' ] ) ) {
1298
- return PT_CV_Functions::debug_output( 'parent_view_not_finished', '' );
1299
- }
1300
-
1301
  $pt_cv_glb[ $id ] = array();
1302
  $pt_cv_glb[ $id ][ 'shortcode_params' ] = $atts;
1303
- $pt_cv_sub_id = $id;
1304
 
1305
  // Get View settings
1306
  $settings = PT_CV_Functions::view_get_settings( $id );
@@ -1317,16 +1229,9 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1317
  * @param string $html
1318
  */
1319
  static function view_final_output( $html ) {
1320
- global $pt_cv_id, $pt_cv_sub_id;
1321
-
1322
- //DEBUG_STYLE
1323
- $view_assets = '';
1324
- if ( $pt_cv_id == $pt_cv_sub_id ) {
1325
- // Print View assets
1326
- ob_start();
1327
- PT_CV_Html::assets_of_view_types();
1328
- $view_assets = ob_get_clean();
1329
- }
1330
 
1331
  return sprintf( '<div class="%s">%s</div>', PT_CV_PREFIX . 'wrapper', $html ) . $view_assets;
1332
  }
@@ -1460,7 +1365,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1460
  'next' => '&rsaquo;',
1461
  'first' => '&laquo;',
1462
  'last' => '&raquo;',
1463
- ) );
1464
 
1465
  $start = ( ( $current_page - $pages_to_show ) > 0 ) ? $current_page - $pages_to_show : 1;
1466
  $end = ( ( $current_page + $pages_to_show ) < $total_pages ) ? $current_page + $pages_to_show : $total_pages;
@@ -1599,6 +1504,50 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1599
  }
1600
  }
1601
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1602
  }
1603
 
1604
  }
118
  */
119
  static function menu_add_sub( $parent_slug, $page_title, $menu_title, $user_role, $sub_page, $class ) {
120
  return add_submenu_page(
121
+ $parent_slug, $page_title, $menu_title, $user_role, $parent_slug . '-' . $sub_page, array( $class, 'display_sub_page_' . $sub_page )
122
  );
123
  }
124
 
515
 
516
  // Query view which has view id = $meta_id
517
  $pt_query = new WP_Query(
518
+ array(
519
  'post_type' => PT_CV_POST_TYPE,
520
  'post_status' => 'publish',
521
  'meta_key' => PT_CV_META_ID,
522
  'meta_value' => esc_sql( $meta_id ),
523
+ )
524
  );
525
  if ( $pt_query->have_posts() ) :
526
  while ( $pt_query->have_posts() ):
572
  return;
573
  }
574
 
575
+ $view_settings = array();
576
+ $post_id = apply_filters( PT_CV_PREFIX_ . 'view_get_post_id', PT_CV_Functions::post_id_from_meta_id( $meta_id ), $meta_id );
577
 
 
578
  if ( $post_id ) {
579
  $view_settings = get_post_meta( $post_id, PT_CV_META_SETTINGS, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
  }
581
 
582
+ return $view_settings;
583
  }
584
 
585
  /**
596
  return __( 'Empty settings', PT_CV_TEXTDOMAIN );
597
  }
598
 
599
+ $view_id = !empty( $id ) ? $id : PT_CV_Functions::string_random();
600
+
601
+ // Check duplicated
602
+ if ( self::duplicate_process( $view_id, $settings, $pargs ) ) {
603
+ return '';
604
+ }
605
+
606
  global $pt_cv_glb, $pt_cv_id;
607
+ if ( !isset( $pt_cv_glb ) ) {
608
  $pt_cv_glb = array();
 
609
  $pt_cv_id = 0;
610
+ }
 
 
 
611
  if ( !isset( $pt_cv_glb[ $view_id ] ) ) {
612
  $pt_cv_glb[ $view_id ] = array();
613
  }
 
 
 
614
 
615
+ // Get View settings
 
 
616
  $view_settings = array();
617
  foreach ( $settings as $key => $value ) {
618
  $view_settings[ $key ] = esc_sql( $value );
619
  }
620
  $pt_cv_glb[ $view_id ][ 'view_settings' ] = $view_settings;
621
 
622
+ // Get content type & view type
623
+ $content_type = apply_filters( PT_CV_PREFIX_ . 'content_type', PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $view_settings ), $view_id );
624
+ $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $view_settings );
 
 
 
 
 
 
 
 
625
 
 
 
626
  $pt_cv_glb[ $view_id ][ 'content_type' ] = $content_type;
 
 
 
627
  $pt_cv_glb[ $view_id ][ 'view_type' ] = $view_type;
628
 
629
+ // Keep current ID
630
+ $pt_cv_cur_id = $view_id;
 
 
 
 
 
 
 
 
631
 
632
+ // Get session id (not empty if is pagination request)
633
+ $session_id = ( $pargs && isset( $pargs[ 'session_id' ] ) ) ? $pargs[ 'session_id' ] : 0;
634
  if ( $session_id ) {
635
  if ( empty( $pt_cv_id ) ) {
636
  $pt_cv_id = $session_id;
637
  }
638
 
639
+ $saved_settings = isset( $_SESSION[ PT_CV_PREFIX . 'view-data-' . $session_id ] ) ? $_SESSION[ PT_CV_PREFIX . 'view-data-' . $session_id ] : array();
640
+ $session_data = array_merge( array( '$args' => '', '$dargs' => '' ), $saved_settings );
641
+ $args = $session_data[ '$args' ];
642
+ $dargs = $session_data[ '$dargs' ];
 
 
 
 
643
  } else {
644
  // Assign view id as current View
645
  $pt_cv_id = $session_id = $view_id;
650
 
651
  // Extract Query & Display settings from settings array
652
  if ( empty( $args ) || empty( $dargs ) ) {
653
+ $dargs = PT_CV_Functions::view_display_settings( $view_type, $dargs );
654
+ $args = PT_CV_Functions::view_filter_settings( $content_type, $view_settings );
655
 
656
  // Store view data
657
  $_SESSION[ PT_CV_PREFIX . 'view-data-' . $session_id ] = array(
663
  // Pagination settings
664
  PT_CV_Functions::view_get_pagination_settings( $dargs, $args, $pargs );
665
 
666
+ // Apply filter
667
+ $dargs = apply_filters( PT_CV_PREFIX_ . 'all_display_settings', $dargs );
668
+ $args = apply_filters( PT_CV_PREFIX_ . 'query_parameters', $args );
669
+
670
  // Update global query parameters variable
671
  $pt_cv_glb[ $view_id ][ 'dargs' ] = $dargs;
672
  $pt_cv_glb[ $view_id ][ 'args' ] = $args;
674
 
675
  // Validate settings, if some required parameters are missing, show error and exit
676
  $error = apply_filters( PT_CV_PREFIX_ . 'validate_settings', array(), $args );
 
 
677
  if ( $error ) {
678
  return ( implode( '</p><p>', $error ) );
679
  }
680
 
 
 
 
681
  $content_items = $pt_query = $empty_result = null;
682
 
683
+ // Page number
684
+ $current_page = self::get_current_page( $pargs );
685
+ $pt_cv_glb[ $pt_cv_id ][ 'current_page' ] = $current_page;
686
+
687
  // What kind of content to display
688
  $pt_cv_glb[ $view_id ][ 'display_what' ] = apply_filters( PT_CV_PREFIX_ . 'display_what', 'post' );
689
 
690
  if ( $pt_cv_glb[ $view_id ][ 'display_what' ] === 'post' ) {
 
691
  extract( self::get_posts_list( $args, $view_type ) );
692
  } else {
 
693
  $content_items = apply_filters( PT_CV_PREFIX_ . 'view_content', array() );
694
  }
695
 
696
+ // Restore current ID
697
+ $pt_cv_id = $pt_cv_cur_id;
698
 
699
+ // Hide empty result
 
 
700
  if ( apply_filters( PT_CV_PREFIX_ . 'hide_empty_result', false ) && $empty_result ) {
 
701
  $html = '';
702
  } else {
703
+ // Wrap items to a wrapper
704
+ $html = PT_CV_Html::content_items_wrap( $content_items, $current_page, $args[ 'posts_per_page' ], $view_id );
 
705
 
706
+ // Show pagination
707
  if ( $pt_query && $args[ 'posts_per_page' ] > 0 && PT_CV_Functions::nonpaging_or_firstpage( $dargs, $current_page ) ) {
708
  // Total post founds
709
  $found_posts = apply_filters( PT_CV_PREFIX_ . 'found_posts', $pt_query->found_posts );
721
  }
722
  }
723
 
 
 
 
724
  return $html;
725
  }
726
 
747
  //print_r( $pt_query->request );
748
  // The Loop
749
  if ( $pt_query->have_posts() ) {
750
+ do_action( PT_CV_PREFIX_ . 'before_process_item' );
751
+
752
  $post_idx = 0;
753
  while ( $pt_query->have_posts() ) {
754
  $pt_query->the_post();
760
  $content_items[ $post->ID ] = PT_CV_Html::view_type_output( $view_type, $post, $post_idx++ );
761
  }
762
  }
763
+
764
+ do_action( PT_CV_PREFIX_ . 'after_process_item' );
765
  } else {
766
  // Get no post found class
767
  $_class = apply_filters( PT_CV_PREFIX_ . 'content_no_post_found_class', 'alert alert-warning' );
868
  * @param string $content_type The content type
869
  */
870
  static function view_get_advanced_settings( &$args, $content_type ) {
871
+ $view_settings = PT_CV_Functions::get_global_variable( 'view_settings' );
872
+ $advanced_settings = (array) PT_CV_Functions::setting_value( PT_CV_PREFIX . 'advanced-settings', $view_settings );
873
 
 
 
 
874
  if ( $advanced_settings ) {
875
  foreach ( $advanced_settings as $setting ) {
876
  switch ( $setting ) {
888
  // Author in
889
  if ( !empty( $author_in[ 0 ] ) ) {
890
  $args = array_merge(
891
+ $args, array(
892
  'author__in' => array_map( 'intval', $author_in ),
893
+ )
894
  );
895
  }
896
 
897
  // Author not in
898
  if ( !empty( $author_not_in[ 0 ] ) ) {
899
  $args = array_merge(
900
+ $args, array(
901
  'author__not_in' => array_map( 'intval', $author_not_in ),
902
+ )
903
  );
904
  }
905
  } else {
906
  // Author = ID
907
  if ( !empty( $author_in[ 0 ] ) ) {
908
  $args = array_merge(
909
+ $args, array(
910
  'author' => intval( $author_in[ 0 ] ),
911
+ )
912
  );
913
  }
914
  }
919
  case 'status':
920
  $status = PT_CV_Functions::string_to_array( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post_status', $view_settings, 'publish' ) );
921
  $args = array_merge(
922
+ $args, array(
923
  'post_status' => apply_filters( PT_CV_PREFIX_ . 'post_status', $status ),
924
+ )
925
  );
926
  break;
927
 
929
  case 'search':
930
  if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 's', $view_settings ) ) {
931
  $args = array_merge(
932
+ $args, array(
933
  's' => PT_CV_Functions::setting_value( PT_CV_PREFIX . 's', $view_settings ),
934
+ )
935
  );
936
  }
937
  break;
951
 
952
  // Get Terms & criterias (In, Not in)
953
  foreach ( $taxonomies as $taxonomy ) {
954
+ $terms = PT_CV_Functions::setting_value( PT_CV_PREFIX . $taxonomy . '-terms', $view_settings );
955
+
956
+ if ( $terms ) {
957
  $operator = PT_CV_Functions::setting_value( PT_CV_PREFIX . $taxonomy . '-operator', $view_settings, 'IN' );
958
 
959
  $taxonomy_setting[] = array(
960
  'taxonomy' => $taxonomy,
961
  'field' => 'slug',
962
+ 'terms' => (array) $terms,
963
  'operator' => $operator,
964
  /*
965
  * @since 1.7.2
985
  // Order
986
  case 'order':
987
  $order_settings = apply_filters(
988
+ PT_CV_PREFIX_ . 'order_setting', array(
989
  'orderby' => PT_CV_Functions::setting_value( PT_CV_PREFIX . 'orderby', $view_settings ),
990
  'order' => PT_CV_Functions::setting_value( PT_CV_PREFIX . 'order', $view_settings ),
991
+ )
992
  );
993
 
994
  $args = array_merge( $args, $order_settings );
1018
  $dargs[ 'layout-format' ] = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'layout-format', $view_settings );
1019
 
1020
  /**
1021
+ * Columns count & Rows
1022
  */
1023
  $dargs[ 'number-columns' ] = apply_filters( PT_CV_PREFIX_ . 'item_per_row', PT_CV_Functions::setting_value( PT_CV_PREFIX . $view_type . '-' . 'number-columns', $view_settings, 1 ) );
1024
  $dargs[ 'number-rows' ] = PT_CV_Functions::setting_value( PT_CV_PREFIX . $view_type . '-' . 'number-rows', $view_settings, 1 );
1092
  * @param array $pargs The pagination settings array
1093
  */
1094
  static function view_get_pagination_settings( &$dargs, &$args, $pargs ) {
 
1095
  $view_settings = PT_CV_Functions::get_global_variable( 'view_settings' );
1096
 
1097
  // Get Limit value
1129
  }
1130
  }
1131
 
 
 
1132
  // Set 'offset' parameter
1133
+ $args[ 'offset' ] = apply_filters( PT_CV_PREFIX_ . 'settings_args_offset', $offset );
1134
  }
1135
 
1136
  /**
1203
  */
1204
  static function view_output( $atts ) {
1205
  $atts = shortcode_atts(
1206
+ apply_filters( PT_CV_PREFIX_ . 'shortcode_params', array( 'id' => 0, ) ), $atts
 
 
 
 
1207
  );
1208
 
 
1209
  $id = esc_sql( $atts[ 'id' ] );
 
1210
  if ( !$id )
1211
  return 'No view ID';
1212
 
1213
+ global $pt_cv_glb;
 
 
 
 
 
 
 
 
 
 
1214
  $pt_cv_glb[ $id ] = array();
1215
  $pt_cv_glb[ $id ][ 'shortcode_params' ] = $atts;
 
1216
 
1217
  // Get View settings
1218
  $settings = PT_CV_Functions::view_get_settings( $id );
1229
  * @param string $html
1230
  */
1231
  static function view_final_output( $html ) {
1232
+ ob_start();
1233
+ PT_CV_Html::assets_of_view_types();
1234
+ $view_assets = ob_get_clean();
 
 
 
 
 
 
 
1235
 
1236
  return sprintf( '<div class="%s">%s</div>', PT_CV_PREFIX . 'wrapper', $html ) . $view_assets;
1237
  }
1365
  'next' => '&rsaquo;',
1366
  'first' => '&laquo;',
1367
  'last' => '&raquo;',
1368
+ ) );
1369
 
1370
  $start = ( ( $current_page - $pages_to_show ) > 0 ) ? $current_page - $pages_to_show : 1;
1371
  $end = ( ( $current_page + $pages_to_show ) < $total_pages ) ? $current_page + $pages_to_show : $total_pages;
1504
  }
1505
  }
1506
 
1507
+ /**
1508
+ * Check duplicated View
1509
+ * @return bool
1510
+ */
1511
+ static function duplicate_process( $view_id, $settings, $pargs ) {
1512
+ if ( empty( $pargs ) && apply_filters( PT_CV_PREFIX_ . 'check_duplicate', 0, $view_id, $settings ) ) {
1513
+ global $pt_cv_glb, $pt_cv_views;
1514
+
1515
+ // Generate unnique ID for current shortcode
1516
+ $sc_params = isset( $pt_cv_glb[ $view_id ][ 'shortcode_params' ] ) ? $pt_cv_glb[ $view_id ][ 'shortcode_params' ] : PT_CV_Functions::string_random();
1517
+ $vid = $view_id . '-' . md5( serialize( $sc_params ) );
1518
+
1519
+ if ( !empty( $pt_cv_views[ $vid ] ) ) {
1520
+ return true;
1521
+ } else {
1522
+ $pt_cv_views[ $vid ] = 1;
1523
+ }
1524
+ }
1525
+
1526
+ return false;
1527
+ }
1528
+
1529
+ /**
1530
+ * Disable View shortcode in posts of current View
1531
+ * @since 1.7.6
1532
+ *
1533
+ * @global array $shortcode_tags
1534
+ * @global array $shortcode_tags_backup
1535
+ * @param string $action
1536
+ */
1537
+ static function disable_view_shortcode( $action = 'disable' ) {
1538
+ if ( apply_filters( PT_CV_PREFIX_ . 'disable_child_shortcode', true ) ) {
1539
+
1540
+ global $shortcode_tags, $shortcode_tags_backup;
1541
+
1542
+ if ( $action == 'disable' ) {
1543
+ $shortcode_tags_backup = $shortcode_tags;
1544
+ $shortcode_tags[ 'pt_view' ] = '__return_false';
1545
+ } else {
1546
+ $shortcode_tags = $shortcode_tags_backup;
1547
+ }
1548
+ }
1549
+ }
1550
+
1551
  }
1552
 
1553
  }
includes/hooks.php CHANGED
@@ -31,6 +31,8 @@ if ( !class_exists( 'PT_CV_Hooks' ) ) {
31
 
32
  // Do action
33
  add_action( PT_CV_PREFIX_ . 'before_query', array( __CLASS__, 'action_before_query' ) );
 
 
34
  }
35
 
36
  /**
@@ -134,6 +136,16 @@ if ( !class_exists( 'PT_CV_Hooks' ) ) {
134
  }
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
137
  }
138
 
139
  }
31
 
32
  // Do action
33
  add_action( PT_CV_PREFIX_ . 'before_query', array( __CLASS__, 'action_before_query' ) );
34
+ add_action( PT_CV_PREFIX_ . 'before_process_item', array( __CLASS__, 'action_before_process_item' ) );
35
+ add_action( PT_CV_PREFIX_ . 'after_process_item', array( __CLASS__, 'action_after_process_item' ) );
36
  }
37
 
38
  /**
136
  }
137
  }
138
 
139
+ public static function action_before_process_item() {
140
+ // Disable View Shortcode in child page
141
+ PT_CV_Functions::disable_view_shortcode();
142
+ }
143
+
144
+ public static function action_after_process_item() {
145
+ // Enable View Shortcode again
146
+ PT_CV_Functions::disable_view_shortcode( 'recovery' );
147
+ }
148
+
149
  }
150
 
151
  }
includes/html-viewtype.php CHANGED
@@ -44,12 +44,7 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
44
  // Get span class
45
  $span_class = apply_filters( PT_CV_PREFIX_ . 'span_class', 'col-md-' );
46
 
47
- // -- Row output
48
- // Get wrapper class of a row
49
- $row_classes = apply_filters( PT_CV_PREFIX_ . 'row_class', array( 'row', PT_CV_PREFIX . 'row' ) );
50
- $row_class = implode( ' ', array_filter( $row_classes ) );
51
-
52
- return array( $columns, $span_width_last, $span_width, $span_class, $row_class );
53
  }
54
 
55
  /**
@@ -64,7 +59,7 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
64
  */
65
  static function grid_wrapper( $content_items, &$content, $column = 0, $class = '' ) {
66
 
67
- list( $columns, $span_width_last, $span_width, $span_class, $row_class ) = self::process_column_width( $column );
68
 
69
  // Split items to rows
70
  $columns_item = array_chunk( $content_items, $columns, true );
@@ -75,7 +70,8 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
75
 
76
  $idx = 0;
77
  foreach ( $items_per_row as $post_id => $content_item ) {
78
- $_span_width = ( $idx == count( $items_per_row ) - 1 ) ? $span_width_last : $span_width;
 
79
 
80
  // Wrap content of item
81
  $item_classes = apply_filters( PT_CV_PREFIX_ . 'item_col_class', array( $span_class . $_span_width, $class ), $_span_width );
@@ -87,11 +83,6 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
87
 
88
  $list_item = implode( "\n", $row_html );
89
 
90
- // Only wrap in row if shuffle filter is not enable
91
- if ( apply_filters( PT_CV_PREFIX_ . 'wrap_in_row', PT_CV_Functions::get_global_variable( 'enable_shuffle_filter' ) != 'yes' ) ) {
92
- $list_item = sprintf( '<div class="%s">%s</div>', esc_attr( $row_class ), $list_item );
93
- }
94
-
95
  $content[] = $list_item;
96
  }
97
  }
@@ -192,7 +183,7 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
192
 
193
  $rows = ( $dargs[ 'number-rows' ] ) ? (int) $dargs[ 'number-rows' ] : 1;
194
 
195
- list( $columns, $span_width_last, $span_width, $span_class, $row_class ) = self::process_column_width();
196
 
197
  // Get wrapper class of a scrollable slide
198
  $slide_class = apply_filters( PT_CV_PREFIX_ . 'scrollable_slide_class', 'item' );
@@ -212,7 +203,8 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
212
  $row_html = array();
213
 
214
  foreach ( $items_per_row as $idx => $content_item ) {
215
- $_span_width = ( $idx == count( $items_per_row ) - 1 ) ? $span_width_last : $span_width;
 
216
 
217
  // Wrap content of item
218
  $item_classes = apply_filters( PT_CV_PREFIX_ . 'item_col_class', array( $span_class . $_span_width ), $_span_width );
@@ -220,7 +212,7 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
220
  $row_html[] = PT_CV_Html::content_item_wrap( $content_item, $item_class );
221
  }
222
 
223
- $slide_html[] = sprintf( '<div class="%s">%s</div>', esc_attr( $row_class ), implode( "\n", $row_html ) );
224
  }
225
 
226
  // Show first slide
@@ -278,7 +270,7 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
278
  $output = '';
279
  if ( $count_slides > 1 ) {
280
  $output = sprintf(
281
- '<a class="left carousel-control" href="#%1$s" data-slide="prev">
282
  <span class="glyphicon glyphicon-chevron-left"></span>
283
  </a>
284
  <a class="right carousel-control" href="#%1$s" data-slide="next">
44
  // Get span class
45
  $span_class = apply_filters( PT_CV_PREFIX_ . 'span_class', 'col-md-' );
46
 
47
+ return array( $columns, $span_width_last, $span_width, $span_class, '' );
 
 
 
 
 
48
  }
49
 
50
  /**
59
  */
60
  static function grid_wrapper( $content_items, &$content, $column = 0, $class = '' ) {
61
 
62
+ list( $columns, $span_width_last, $span_width, $span_class ) = self::process_column_width( $column );
63
 
64
  // Split items to rows
65
  $columns_item = array_chunk( $content_items, $columns, true );
70
 
71
  $idx = 0;
72
  foreach ( $items_per_row as $post_id => $content_item ) {
73
+ $count = count( $items_per_row );
74
+ $_span_width = ( $count == $columns && $idx + 1 == $count ) ? $span_width_last : $span_width;
75
 
76
  // Wrap content of item
77
  $item_classes = apply_filters( PT_CV_PREFIX_ . 'item_col_class', array( $span_class . $_span_width, $class ), $_span_width );
83
 
84
  $list_item = implode( "\n", $row_html );
85
 
 
 
 
 
 
86
  $content[] = $list_item;
87
  }
88
  }
183
 
184
  $rows = ( $dargs[ 'number-rows' ] ) ? (int) $dargs[ 'number-rows' ] : 1;
185
 
186
+ list( $columns, $span_width_last, $span_width, $span_class ) = self::process_column_width();
187
 
188
  // Get wrapper class of a scrollable slide
189
  $slide_class = apply_filters( PT_CV_PREFIX_ . 'scrollable_slide_class', 'item' );
203
  $row_html = array();
204
 
205
  foreach ( $items_per_row as $idx => $content_item ) {
206
+ $count = count( $items_per_row );
207
+ $_span_width = ( $count == $columns && $idx + 1 == $count ) ? $span_width_last : $span_width;
208
 
209
  // Wrap content of item
210
  $item_classes = apply_filters( PT_CV_PREFIX_ . 'item_col_class', array( $span_class . $_span_width ), $_span_width );
212
  $row_html[] = PT_CV_Html::content_item_wrap( $content_item, $item_class );
213
  }
214
 
215
+ $slide_html[] = implode( "\n", $row_html );
216
  }
217
 
218
  // Show first slide
270
  $output = '';
271
  if ( $count_slides > 1 ) {
272
  $output = sprintf(
273
+ '<a class="left carousel-control" href="#%1$s" data-slide="prev">
274
  <span class="glyphicon glyphicon-chevron-left"></span>
275
  </a>
276
  <a class="right carousel-control" href="#%1$s" data-slide="next">
includes/html.php CHANGED
@@ -183,7 +183,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
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
 
@@ -332,9 +332,8 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
332
 
333
  // ID for the wrapper
334
  $view_id = PT_CV_PREFIX . 'view-' . $id;
335
-
336
- $output = sprintf( '<div class="%s" id="%s" %s>%s</div>', esc_attr( implode( ' ', array_filter( $view_class ) ) ), esc_attr( $view_id ), $page_attr, $html );
337
-
338
  do_action( PT_CV_PREFIX_ . 'store_view_data', $view_id );
339
  } else {
340
  $output = $html;
@@ -438,7 +437,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
438
  $title = apply_filters( PT_CV_PREFIX_ . 'field_title_result', $title, $fargs, $post->ID );
439
 
440
  $html = sprintf(
441
- '<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr( $title_class ), self::_field_href( $oargs, $post, $title )
442
  );
443
 
444
  return apply_filters( PT_CV_PREFIX_ . 'field_title_extra', $html, $post );
@@ -497,7 +496,8 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
497
  $excerpt = apply_filters( PT_CV_PREFIX_ . 'trim_length_excerpt', $trimmed_excerpt, $full_excerpt, $length );
498
 
499
  // Append readmore button
500
- $content = $excerpt . $readmore_html;
 
501
  } else {
502
  // Display only readmore button if length <= 0
503
  $content = $readmore_btn;
@@ -519,8 +519,8 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
519
  $content = apply_filters( PT_CV_PREFIX_ . 'field_content_final', $content, $post );
520
 
521
  $html = rtrim( $content, '.' ) ? sprintf(
522
- '<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr( $content_class ), force_balance_tags( $content )
523
- ) : '';
524
 
525
  return $html;
526
  }
@@ -555,7 +555,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
555
 
556
  // Generate a tag
557
  $html = sprintf(
558
- '<a href="%s" class="%s" target="%s" %s>%s</a>', $href, implode( ' ', array_filter( $href_class ) ), $open_in, implode( ' ', array_filter( $custom_attr ) ), $content
559
  );
560
 
561
  return $html;
@@ -733,7 +733,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
733
 
734
  // Define wrapper
735
  $wrapper = sprintf(
736
- '<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr( $meta_fields_class ), '%s'
737
  );
738
 
739
  // Join fields
@@ -843,15 +843,15 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
843
 
844
  // Public script
845
  PT_CV_Asset::enqueue(
846
- 'public', 'script', array(
847
  'src' => plugins_url( 'public/assets/js/public.js', PT_CV_FILE ),
848
  'deps' => array( 'jquery' ),
849
- )
850
  );
851
 
852
  // Localize for Public script
853
  PT_CV_Asset::localize_script(
854
- 'public', PT_CV_PREFIX_UPPER . 'PUBLIC', array(
855
  '_prefix' => PT_CV_PREFIX,
856
  'page_to_show' => apply_filters( PT_CV_PREFIX_ . 'pages_to_show', 5 ),
857
  '_nonce' => wp_create_nonce( PT_CV_PREFIX_ . 'ajax_nonce' ),
@@ -859,12 +859,12 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
859
  'is_mobile' => apply_filters( PT_CV_PREFIX_ . 'is_mobile', wp_is_mobile() ),
860
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
861
  'lang' => PT_CV_Functions::get_language(), #Get current language of site
862
- )
863
  );
864
 
865
  // Localize for Pagination script
866
  PT_CV_Asset::localize_script(
867
- 'bootstrap-paginator', PT_CV_PREFIX_UPPER . 'PAGINATION', array(
868
  'first' => apply_filters( PT_CV_PREFIX_ . 'pagination_first', '&laquo;' ),
869
  'prev' => apply_filters( PT_CV_PREFIX_ . 'pagination_prev', '&lsaquo;' ),
870
  'next' => apply_filters( PT_CV_PREFIX_ . 'pagination_next', '&rsaquo;' ),
@@ -875,7 +875,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
875
  'goto_last' => apply_filters( PT_CV_PREFIX_ . 'goto_last', __( 'Go to last page', PT_CV_TEXTDOMAIN ) ),
876
  'current_page' => apply_filters( PT_CV_PREFIX_ . 'current_page', __( 'Current page is', PT_CV_TEXTDOMAIN ) ),
877
  'goto_page' => apply_filters( PT_CV_PREFIX_ . 'goto_page', __( 'Go to page', PT_CV_TEXTDOMAIN ) ),
878
- )
879
  );
880
 
881
  // Load Pro scripts
@@ -894,25 +894,25 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
894
  }
895
 
896
  PT_CV_Asset::enqueue(
897
- 'public', 'style', array(
898
  'src' => plugins_url( 'public/assets/css/public.css', PT_CV_FILE ),
899
- )
900
  );
901
 
902
  // Fix bootstrap error in IE
903
  global $is_IE;
904
  if ( $is_IE ) {
905
  PT_CV_Asset::enqueue(
906
- 'html5shiv', 'script', array(
907
  'src' => plugins_url( 'assets/ie-fix/html5shiv.min.js', PT_CV_FILE ),
908
  'ver' => '3.7.0',
909
- )
910
  );
911
  PT_CV_Asset::enqueue(
912
- 'respond', 'script', array(
913
  'src' => plugins_url( 'assets/ie-fix/respond.js', PT_CV_FILE ),
914
  'ver' => '1.4.2',
915
- )
916
  );
917
  }
918
 
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 ( (array) $other_dargs[ 'fields' ] as $field_name ) {
187
  // Get settings of fields
188
  $fargs = isset( $other_dargs[ 'field-settings' ] ) ? $other_dargs[ 'field-settings' ] : array();
189
 
332
 
333
  // ID for the wrapper
334
  $view_id = PT_CV_PREFIX . 'view-' . $id;
335
+ $output = sprintf( '<div class="%s" id="%s" %s>%s</div>', esc_attr( implode( ' ', array_filter( $view_class ) ) ), esc_attr( $view_id ), $page_attr, $html );
336
+ // Keep this action for CVP < 3.5
 
337
  do_action( PT_CV_PREFIX_ . 'store_view_data', $view_id );
338
  } else {
339
  $output = $html;
437
  $title = apply_filters( PT_CV_PREFIX_ . 'field_title_result', $title, $fargs, $post->ID );
438
 
439
  $html = sprintf(
440
+ '<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr( $title_class ), self::_field_href( $oargs, $post, $title )
441
  );
442
 
443
  return apply_filters( PT_CV_PREFIX_ . 'field_title_extra', $html, $post );
496
  $excerpt = apply_filters( PT_CV_PREFIX_ . 'trim_length_excerpt', $trimmed_excerpt, $full_excerpt, $length );
497
 
498
  // Append readmore button
499
+ $hide_readmore = apply_filters( PT_CV_PREFIX_ . 'hide_readmore', false, $excerpt, $full_excerpt, $post );
500
+ $content = $excerpt . ($hide_readmore ? '' : $readmore_html);
501
  } else {
502
  // Display only readmore button if length <= 0
503
  $content = $readmore_btn;
519
  $content = apply_filters( PT_CV_PREFIX_ . 'field_content_final', $content, $post );
520
 
521
  $html = rtrim( $content, '.' ) ? sprintf(
522
+ '<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr( $content_class ), force_balance_tags( $content )
523
+ ) : '';
524
 
525
  return $html;
526
  }
555
 
556
  // Generate a tag
557
  $html = sprintf(
558
+ '<a href="%s" class="%s" target="%s" %s>%s</a>', $href, implode( ' ', array_filter( $href_class ) ), $open_in, implode( ' ', array_filter( $custom_attr ) ), $content
559
  );
560
 
561
  return $html;
733
 
734
  // Define wrapper
735
  $wrapper = sprintf(
736
+ '<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr( $meta_fields_class ), '%s'
737
  );
738
 
739
  // Join fields
843
 
844
  // Public script
845
  PT_CV_Asset::enqueue(
846
+ 'public', 'script', array(
847
  'src' => plugins_url( 'public/assets/js/public.js', PT_CV_FILE ),
848
  'deps' => array( 'jquery' ),
849
+ )
850
  );
851
 
852
  // Localize for Public script
853
  PT_CV_Asset::localize_script(
854
+ 'public', PT_CV_PREFIX_UPPER . 'PUBLIC', array(
855
  '_prefix' => PT_CV_PREFIX,
856
  'page_to_show' => apply_filters( PT_CV_PREFIX_ . 'pages_to_show', 5 ),
857
  '_nonce' => wp_create_nonce( PT_CV_PREFIX_ . 'ajax_nonce' ),
859
  'is_mobile' => apply_filters( PT_CV_PREFIX_ . 'is_mobile', wp_is_mobile() ),
860
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
861
  'lang' => PT_CV_Functions::get_language(), #Get current language of site
862
+ )
863
  );
864
 
865
  // Localize for Pagination script
866
  PT_CV_Asset::localize_script(
867
+ 'bootstrap-paginator', PT_CV_PREFIX_UPPER . 'PAGINATION', array(
868
  'first' => apply_filters( PT_CV_PREFIX_ . 'pagination_first', '&laquo;' ),
869
  'prev' => apply_filters( PT_CV_PREFIX_ . 'pagination_prev', '&lsaquo;' ),
870
  'next' => apply_filters( PT_CV_PREFIX_ . 'pagination_next', '&rsaquo;' ),
875
  'goto_last' => apply_filters( PT_CV_PREFIX_ . 'goto_last', __( 'Go to last page', PT_CV_TEXTDOMAIN ) ),
876
  'current_page' => apply_filters( PT_CV_PREFIX_ . 'current_page', __( 'Current page is', PT_CV_TEXTDOMAIN ) ),
877
  'goto_page' => apply_filters( PT_CV_PREFIX_ . 'goto_page', __( 'Go to page', PT_CV_TEXTDOMAIN ) ),
878
+ )
879
  );
880
 
881
  // Load Pro scripts
894
  }
895
 
896
  PT_CV_Asset::enqueue(
897
+ 'public', 'style', array(
898
  'src' => plugins_url( 'public/assets/css/public.css', PT_CV_FILE ),
899
+ )
900
  );
901
 
902
  // Fix bootstrap error in IE
903
  global $is_IE;
904
  if ( $is_IE ) {
905
  PT_CV_Asset::enqueue(
906
+ 'html5shiv', 'script', array(
907
  'src' => plugins_url( 'assets/ie-fix/html5shiv.min.js', PT_CV_FILE ),
908
  'ver' => '3.7.0',
909
+ )
910
  );
911
  PT_CV_Asset::enqueue(
912
+ 'respond', 'script', array(
913
  'src' => plugins_url( 'assets/ie-fix/respond.js', PT_CV_FILE ),
914
  'ver' => '1.4.2',
915
+ )
916
  );
917
  }
918
 
includes/settings.php CHANGED
@@ -55,10 +55,10 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
55
  ),
56
  //Operator
57
  array(
58
- 'label' => array(
59
  'text' => __( 'Operator', PT_CV_TEXTDOMAIN ),
60
  ),
61
- 'params' => array(
62
  array(
63
  'type' => 'select',
64
  'name' => $taxonomy_slug . '-operator',
@@ -66,6 +66,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
66
  'std' => 'IN',
67
  ),
68
  ),
 
69
  ),
70
  );
71
  }
@@ -93,12 +94,11 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
93
  'name' => 'orderby',
94
  'options' => PT_CV_Values::post_regular_orderby(),
95
  'std' => '',
96
- 'desc' => __( 'Select a criteria to sort by', PT_CV_TEXTDOMAIN ),
97
  ),
98
  ),
99
  ),
100
  // Order
101
- array(
102
  'label' => array(
103
  'text' => __( 'Order', PT_CV_TEXTDOMAIN ),
104
  ),
@@ -110,7 +110,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
110
  'std' => 'asc',
111
  ),
112
  ),
113
- ),
114
  );
115
 
116
  $result = apply_filters( PT_CV_PREFIX_ . 'orderby', $result );
@@ -157,8 +157,8 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
157
  'type' => 'number',
158
  'name' => $prefix . 'items-per-page',
159
  'std' => '5',
160
- 'placeholder' => 'e.g. 5',
161
- 'desc' => __( 'The number of items per page.<br>If value of <code>Limit</code> setting is not blank (empty), this value should be smaller than <code>Limit</code> value', PT_CV_TEXTDOMAIN ),
162
  ),
163
  ),
164
  'dependence' => array( 'enable-pagination', 'yes' ),
@@ -166,7 +166,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
166
  // Pagination Type
167
  array(
168
  'label' => array(
169
- 'text' => __( 'Pagination type', PT_CV_TEXTDOMAIN ),
170
  ),
171
  'params' => array(
172
  array(
@@ -194,7 +194,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
194
  'params' => array(
195
  array(
196
  'label' => array(
197
- 'text' => __( 'Pagination style', PT_CV_TEXTDOMAIN ),
198
  ),
199
  'params' => array(
200
  array(
@@ -237,7 +237,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
237
  'name' => $prefix . 'open-in',
238
  'options' => PT_CV_Values::open_in(),
239
  'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::open_in() ),
240
- 'desc' => __( 'How to open an item when click on Title, Thumbnail, Read more button', PT_CV_TEXTDOMAIN ),
241
  ),
242
  ),
243
  ),
@@ -276,7 +276,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
276
  ),
277
  ),
278
  // Upgrade to Pro: Drag & Drop
279
- !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Display Title above Thumbnail ?', PT_CV_TEXTDOMAIN ), 12, 'margin-top: -15px; margin-bottom: 5px;' ) : '',
280
  // Title settings
281
  apply_filters( PT_CV_PREFIX_ . 'settings_title_display', array(), $prefix, $prefix2 ),
282
  // Thumbnail settings
@@ -336,7 +336,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
336
  array(
337
  'type' => 'group',
338
  'params' => apply_filters(
339
- PT_CV_PREFIX_ . 'excerpt_settings', array(
340
  // Excerpt length
341
  array(
342
  'label' => array(
@@ -347,25 +347,20 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
347
  'type' => 'number',
348
  'name' => $prefix . 'excerpt-length',
349
  'std' => '20',
350
- 'placeholder' => 'e.g. 20',
351
  'append_text' => 'words',
352
- 'desc' => __( 'Generating excerpt by selecting the first X words of the content', PT_CV_TEXTDOMAIN ),
353
  ),
354
  ),
355
  ),
356
  // Upgrade to Pro: Manual excerpt
357
- !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Use manual excerpt, change "Read More" text ?', PT_CV_TEXTDOMAIN ), 9 ) : '',
358
  // Allow HTML tags
359
  array(
360
- 'label' => array(
361
  'text' => '',
362
  ),
363
- 'extra_setting' => array(
364
- 'params' => array(
365
- 'wrap-class' => PT_CV_PREFIX . 'full-fields',
366
- ),
367
- ),
368
- 'params' => array(
369
  array(
370
  'type' => 'checkbox',
371
  'name' => $prefix . 'excerpt-allow_html',
@@ -374,7 +369,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
374
  ),
375
  ),
376
  ),
377
- ), $prefix . 'excerpt-'
378
  ),
379
  ),
380
  ),
@@ -544,7 +539,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
544
  array(
545
  'type' => 'checkbox',
546
  'name' => $prefix . 'meta-fields',
547
- 'options' => PT_CV_Values::yes_no( 'yes', __( 'Show Meta Fields (Author, Date, Comment...)', PT_CV_TEXTDOMAIN ) ),
548
  'std' => '',
549
  ),
550
  ),
@@ -569,7 +564,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
569
  // Size
570
  array(
571
  'label' => array(
572
- 'text' => __( 'Thumbnail size', PT_CV_TEXTDOMAIN ),
573
  ),
574
  'params' => array(
575
  array(
@@ -582,7 +577,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
582
  ),
583
  // Disable WP 4.4 responsive image
584
  !PT_CV_Functions::wp_version_compare( '4.4' ) ? '' :
585
- array(
586
  'label' => array(
587
  'text' => '',
588
  ),
@@ -600,7 +595,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
600
  'desc' => __( 'Check this option if thumbnail looks blurry', PT_CV_TEXTDOMAIN ),
601
  ),
602
  ),
603
- ),
604
  );
605
 
606
  $result = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_settings', $result, $prefix );
@@ -720,7 +715,6 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
720
  'name' => $prefix . 'number-columns',
721
  'std' => '2',
722
  'append_text' => '1 &rarr; 12',
723
- 'desc' => __( 'The number of columns in layout', PT_CV_TEXTDOMAIN ),
724
  ),
725
  ),
726
  'dependence' => array( 'view-type', 'grid' ),
@@ -799,7 +793,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
799
  * @param int $width
800
  * @return type
801
  */
802
- static function get_cvpro( $text, $width, $style = '' ) {
803
  $url = sprintf( ' <a href="%s" target="_blank">%s</a>', esc_url( 'http://www.contentviewspro.com/pricing/?utm_source=client&utm_medium=view' ), __( 'Get CVPro now!', PT_CV_TEXTDOMAIN ) );
804
 
805
  return array(
55
  ),
56
  //Operator
57
  array(
58
+ 'label' => array(
59
  'text' => __( 'Operator', PT_CV_TEXTDOMAIN ),
60
  ),
61
+ 'params' => array(
62
  array(
63
  'type' => 'select',
64
  'name' => $taxonomy_slug . '-operator',
66
  'std' => 'IN',
67
  ),
68
  ),
69
+ 'dependence' => array( 'taxonomy-term-info', 'as_output', '!=' ),
70
  ),
71
  );
72
  }
94
  'name' => 'orderby',
95
  'options' => PT_CV_Values::post_regular_orderby(),
96
  'std' => '',
 
97
  ),
98
  ),
99
  ),
100
  // Order
101
+ apply_filters( PT_CV_PREFIX_ . 'orders', array(
102
  'label' => array(
103
  'text' => __( 'Order', PT_CV_TEXTDOMAIN ),
104
  ),
110
  'std' => 'asc',
111
  ),
112
  ),
113
+ ) ),
114
  );
115
 
116
  $result = apply_filters( PT_CV_PREFIX_ . 'orderby', $result );
157
  'type' => 'number',
158
  'name' => $prefix . 'items-per-page',
159
  'std' => '5',
160
+ 'placeholder' => 'for example: 5',
161
+ 'desc' => __( 'If value of <code>Limit</code> setting is not blank (empty), this value should be smaller than <code>Limit</code> value', PT_CV_TEXTDOMAIN ),
162
  ),
163
  ),
164
  'dependence' => array( 'enable-pagination', 'yes' ),
166
  // Pagination Type
167
  array(
168
  'label' => array(
169
+ 'text' => __( 'Type', PT_CV_TEXTDOMAIN ),
170
  ),
171
  'params' => array(
172
  array(
194
  'params' => array(
195
  array(
196
  'label' => array(
197
+ 'text' => __( 'Style', PT_CV_TEXTDOMAIN ),
198
  ),
199
  'params' => array(
200
  array(
237
  'name' => $prefix . 'open-in',
238
  'options' => PT_CV_Values::open_in(),
239
  'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::open_in() ),
240
+ 'desc' => __( 'How to open item when click on Title, Thumbnail, Read-more button', PT_CV_TEXTDOMAIN ),
241
  ),
242
  ),
243
  ),
276
  ),
277
  ),
278
  // Upgrade to Pro: Drag & Drop
279
+ !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Show Title above Thumbnail ?', PT_CV_TEXTDOMAIN ), 12, 'margin-top: -15px; margin-bottom: 5px;' ) : '',
280
  // Title settings
281
  apply_filters( PT_CV_PREFIX_ . 'settings_title_display', array(), $prefix, $prefix2 ),
282
  // Thumbnail settings
336
  array(
337
  'type' => 'group',
338
  'params' => apply_filters(
339
+ PT_CV_PREFIX_ . 'excerpt_settings', array(
340
  // Excerpt length
341
  array(
342
  'label' => array(
347
  'type' => 'number',
348
  'name' => $prefix . 'excerpt-length',
349
  'std' => '20',
350
+ 'placeholder' => 'for example: 20',
351
  'append_text' => 'words',
352
+ 'desc' => __( 'Generate excerpt by selecting the first X words of post content', PT_CV_TEXTDOMAIN ),
353
  ),
354
  ),
355
  ),
356
  // Upgrade to Pro: Manual excerpt
357
+ !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Use manual excerpt, change <code>Read More</code> text ?', PT_CV_TEXTDOMAIN ) ) : '',
358
  // Allow HTML tags
359
  array(
360
+ 'label' => array(
361
  'text' => '',
362
  ),
363
+ 'params' => array(
 
 
 
 
 
364
  array(
365
  'type' => 'checkbox',
366
  'name' => $prefix . 'excerpt-allow_html',
369
  ),
370
  ),
371
  ),
372
+ ), $prefix . 'excerpt-'
373
  ),
374
  ),
375
  ),
539
  array(
540
  'type' => 'checkbox',
541
  'name' => $prefix . 'meta-fields',
542
+ 'options' => PT_CV_Values::yes_no( 'yes', __( 'Show Meta Fields (author, date, taxonomy, comment)', PT_CV_TEXTDOMAIN ) ),
543
  'std' => '',
544
  ),
545
  ),
564
  // Size
565
  array(
566
  'label' => array(
567
+ 'text' => __( 'Size', PT_CV_TEXTDOMAIN ),
568
  ),
569
  'params' => array(
570
  array(
577
  ),
578
  // Disable WP 4.4 responsive image
579
  !PT_CV_Functions::wp_version_compare( '4.4' ) ? '' :
580
+ array(
581
  'label' => array(
582
  'text' => '',
583
  ),
595
  'desc' => __( 'Check this option if thumbnail looks blurry', PT_CV_TEXTDOMAIN ),
596
  ),
597
  ),
598
+ ),
599
  );
600
 
601
  $result = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_settings', $result, $prefix );
715
  'name' => $prefix . 'number-columns',
716
  'std' => '2',
717
  'append_text' => '1 &rarr; 12',
 
718
  ),
719
  ),
720
  'dependence' => array( 'view-type', 'grid' ),
793
  * @param int $width
794
  * @return type
795
  */
796
+ static function get_cvpro( $text, $width = 10, $style = '' ) {
797
  $url = sprintf( ' <a href="%s" target="_blank">%s</a>', esc_url( 'http://www.contentviewspro.com/pricing/?utm_source=client&utm_medium=view' ), __( 'Get CVPro now!', PT_CV_TEXTDOMAIN ) );
798
 
799
  return array(
includes/values.php CHANGED
@@ -92,8 +92,8 @@ if ( !class_exists( 'PT_CV_Values' ) ) {
92
  */
93
  static function taxonomy_relation() {
94
  return array(
95
- 'AND' => __( 'AND', PT_CV_TEXTDOMAIN ),
96
- 'OR' => __( 'OR', PT_CV_TEXTDOMAIN ),
97
  );
98
  }
99
 
@@ -103,9 +103,9 @@ if ( !class_exists( 'PT_CV_Values' ) ) {
103
  */
104
  static function taxonomy_operators() {
105
  return array(
106
- 'IN' => __( 'IN', PT_CV_TEXTDOMAIN ) . ' &#8212; ' . __( 'A post is displayed only if it associated with at least one value in terms list', PT_CV_TEXTDOMAIN ),
107
- 'NOT IN' => __( 'NOT IN', PT_CV_TEXTDOMAIN ) . ' &#8212; ' . __( 'A post is displayed only if it did NOT associated with any values in terms list', PT_CV_TEXTDOMAIN ),
108
- 'AND' => __( 'AND', PT_CV_TEXTDOMAIN ) . ' &#8212; ' . __( 'A post is displayed only if it associated with all values in terms list', PT_CV_TEXTDOMAIN ),
109
  );
110
  }
111
 
@@ -267,13 +267,13 @@ if ( !class_exists( 'PT_CV_Values' ) ) {
267
  */
268
  static function advanced_settings() {
269
  return apply_filters(
270
- PT_CV_PREFIX_ . 'advanced_settings', array(
271
  'taxonomy' => __( 'Taxonomy (Categories, Tags...)', PT_CV_TEXTDOMAIN ),
272
  'status' => __( 'Status', PT_CV_TEXTDOMAIN ),
273
- 'order' => __( 'Order & Orderby', PT_CV_TEXTDOMAIN ),
274
  'search' => __( 'Search', PT_CV_TEXTDOMAIN ),
275
  'author' => __( 'Author', PT_CV_TEXTDOMAIN ),
276
- )
277
  );
278
  }
279
 
@@ -286,7 +286,7 @@ if ( !class_exists( 'PT_CV_Values' ) ) {
286
  $field_name = PT_CV_PREFIX . $name;
287
  $selected = isset( $data[ $field_name ] ) ? $data[ $field_name ] : '';
288
 
289
- return wp_dropdown_users( array( 'name' => $field_name, 'selected' => $selected, 'class' => 'form-control', 'show_option_none' => __( '&mdash; Select &mdash;', PT_CV_TEXTDOMAIN ), 'echo' => false ) );
290
  }
291
 
292
  /**
@@ -321,7 +321,7 @@ if ( !class_exists( 'PT_CV_Values' ) ) {
321
  */
322
  static function post_regular_orderby() {
323
  $regular_orderby = array(
324
- '' => __( '&mdash; Select &mdash;', PT_CV_TEXTDOMAIN ),
325
  'ID' => __( 'ID', PT_CV_TEXTDOMAIN ),
326
  'title' => __( 'Title', PT_CV_TEXTDOMAIN ),
327
  'date' => __( 'Created date', PT_CV_TEXTDOMAIN ),
@@ -382,8 +382,8 @@ if ( !class_exists( 'PT_CV_Values' ) ) {
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
 
389
  $result = apply_filters( PT_CV_PREFIX_ . 'layout_format', $result );
92
  */
93
  static function taxonomy_relation() {
94
  return array(
95
+ 'AND' => __( 'AND', PT_CV_TEXTDOMAIN ) . ' &#8212; ' . __( 'show posts which match all settings', PT_CV_TEXTDOMAIN ),
96
+ 'OR' => __( 'OR', PT_CV_TEXTDOMAIN ) . ' &#8212; ' . __( 'show posts which match one or more settings', PT_CV_TEXTDOMAIN ),
97
  );
98
  }
99
 
103
  */
104
  static function taxonomy_operators() {
105
  return array(
106
+ 'IN' => __( 'IN', PT_CV_TEXTDOMAIN ) . ' &#8212; ' . __( 'show posts which associate with one or more of selected terms', PT_CV_TEXTDOMAIN ),
107
+ 'NOT IN' => __( 'NOT IN', PT_CV_TEXTDOMAIN ) . ' &#8212; ' . __( 'show posts which do not associate with any of selected terms', PT_CV_TEXTDOMAIN ),
108
+ 'AND' => __( 'AND', PT_CV_TEXTDOMAIN ) . ' &#8212; ' . __( 'show posts which associate with all of selected terms', PT_CV_TEXTDOMAIN ),
109
  );
110
  }
111
 
267
  */
268
  static function advanced_settings() {
269
  return apply_filters(
270
+ PT_CV_PREFIX_ . 'advanced_settings', array(
271
  'taxonomy' => __( 'Taxonomy (Categories, Tags...)', PT_CV_TEXTDOMAIN ),
272
  'status' => __( 'Status', PT_CV_TEXTDOMAIN ),
273
+ 'order' => __( 'Order', PT_CV_TEXTDOMAIN ),
274
  'search' => __( 'Search', PT_CV_TEXTDOMAIN ),
275
  'author' => __( 'Author', PT_CV_TEXTDOMAIN ),
276
+ )
277
  );
278
  }
279
 
286
  $field_name = PT_CV_PREFIX . $name;
287
  $selected = isset( $data[ $field_name ] ) ? $data[ $field_name ] : '';
288
 
289
+ return wp_dropdown_users( array( 'name' => $field_name, 'selected' => $selected, 'class' => 'form-control', 'show_option_none' => __( '- Select -', PT_CV_TEXTDOMAIN ), 'echo' => false ) );
290
  }
291
 
292
  /**
321
  */
322
  static function post_regular_orderby() {
323
  $regular_orderby = array(
324
+ '' => __( '- Select -', PT_CV_TEXTDOMAIN ),
325
  'ID' => __( 'ID', PT_CV_TEXTDOMAIN ),
326
  'title' => __( 'Title', PT_CV_TEXTDOMAIN ),
327
  'date' => __( 'Created date', PT_CV_TEXTDOMAIN ),
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
 
389
  $result = apply_filters( PT_CV_PREFIX_ . 'layout_format', $result );
public/assets/css/public.css CHANGED
@@ -9,9 +9,6 @@
9
  */
10
 
11
  /* Fix Bootstrap box-sizing "border-box" problem */
12
- .pt-cv-row *,
13
- .pt-cv-row *:before,
14
- .pt-cv-row *:after,
15
  .pt-cv-view *,
16
  .pt-cv-view *:before,
17
  .pt-cv-view *:after {
@@ -22,15 +19,44 @@
22
 
23
  /* Common */
24
  .pt-cv-view {
 
 
 
25
  position: relative;
26
  clear: both;
27
  }
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  .pt-cv-page {
30
  position: relative;
31
  }
32
 
33
- .pt-cv-row {
34
  clear: left;
35
  }
36
 
@@ -110,13 +136,16 @@
110
  min-height: 80px;
111
  }
112
 
113
- /* Content */
114
  .pt-cv-content, .pt-cv-content * {
115
- font-size: 14px;
116
  font-weight: 400;
117
  zoom: 1;
118
  line-height: 1.6em;
119
  }
 
 
 
 
120
 
121
  /* Meta fields */
122
  .pt-cv-meta-fields {
@@ -302,10 +331,11 @@
302
  }
303
 
304
  /* Layout */
305
- .pt-cv-view .pt-cv-2-col .pt-cv-title {
306
  clear: none !important;
307
  }
308
  @media (max-width: 480px) {
 
309
  .pt-cv-nolf.pt-cv-2-col .pt-cv-thumbnail{
310
  float: none !important;
311
  margin: 0;
9
  */
10
 
11
  /* Fix Bootstrap box-sizing "border-box" problem */
 
 
 
12
  .pt-cv-view *,
13
  .pt-cv-view *:before,
14
  .pt-cv-view *:after {
19
 
20
  /* Common */
21
  .pt-cv-view {
22
+ margin-left: -15px;
23
+ margin-right: -15px;
24
+
25
  position: relative;
26
  clear: both;
27
  }
28
 
29
+ .pt-cv-collapsible {
30
+ margin-left: 0;
31
+ margin-right: 0;
32
+ }
33
+
34
+ .pt-cv-view:after {
35
+ clear: both;
36
+ content: "";
37
+ display: block;
38
+ }
39
+
40
+ .pt-cv-view [data-cvc="2"] .col-md-6:nth-child(2n+1),
41
+ .pt-cv-view [data-cvc="3"] .col-md-4:nth-child(3n+1),
42
+ .pt-cv-view [data-cvc="4"] .col-md-3:nth-child(4n+1),
43
+ .pt-cv-view [data-cvc="5"] .col-md-2:nth-child(5n+1),
44
+ .pt-cv-view [data-cvc="6"] .col-md-2:nth-child(6n+1),
45
+ .pt-cv-view [data-cvc="7"] .col-md-1:nth-child(7n+1),
46
+ .pt-cv-view [data-cvc="8"] .col-md-1:nth-child(8n+1),
47
+ .pt-cv-view [data-cvc="9"] .col-md-1:nth-child(9n+1),
48
+ .pt-cv-view [data-cvc="10"] .col-md-1:nth-child(10n+1),
49
+ .pt-cv-view [data-cvc="11"] .col-md-1:nth-child(11n+1),
50
+ .pt-cv-view [data-cvc="12"] .col-md-1:nth-child(12n+1)
51
+ {
52
+ clear: left !important;
53
+ }
54
+
55
  .pt-cv-page {
56
  position: relative;
57
  }
58
 
59
+ .pt-cv-gls-group{
60
  clear: left;
61
  }
62
 
136
  min-height: 80px;
137
  }
138
 
139
+ /** Content **/
140
  .pt-cv-content, .pt-cv-content * {
 
141
  font-weight: 400;
142
  zoom: 1;
143
  line-height: 1.6em;
144
  }
145
+ /* Able to use default font-size if add class "pt-cv-nfs" */
146
+ .pt-cv-content:not(.pt-cv-nfs), .pt-cv-content:not(.pt-cv-nfs) * {
147
+ font-size: 14px;
148
+ }
149
 
150
  /* Meta fields */
151
  .pt-cv-meta-fields {
331
  }
332
 
333
  /* Layout */
334
+ .pt-cv-2-col .pt-cv-title {
335
  clear: none !important;
336
  }
337
  @media (max-width: 480px) {
338
+ /* Disable 2 columns in extra small screens */
339
  .pt-cv-nolf.pt-cv-2-col .pt-cv-thumbnail{
340
  float: none !important;
341
  margin: 0;
public/assets/js/public.js CHANGED
@@ -137,6 +137,9 @@
137
  callback();
138
  }
139
 
 
 
 
140
  return;
141
  }
142
 
@@ -173,7 +176,7 @@
173
  callback();
174
  }
175
 
176
- // Trigger to make Pinterest layout works when do pagination
177
  $( 'body' ).trigger( _prefix + 'pagination-finished' );
178
  } );
179
  },
137
  callback();
138
  }
139
 
140
+ // Trigger action on finish pagination
141
+ $( 'body' ).trigger( _prefix + 'pagination-finished-simple' );
142
+
143
  return;
144
  }
145
 
176
  callback();
177
  }
178
 
179
+ // Trigger action on finish pagination
180
  $( 'body' ).trigger( _prefix + 'pagination-finished' );
181
  } );
182
  },
public/content-views.php CHANGED
@@ -351,6 +351,8 @@ class PT_Content_Views {
351
  PT_CV_Html::frontend_scripts();
352
  }
353
  }
 
 
354
  }
355
 
356
  /**
@@ -377,8 +379,9 @@ class PT_Content_Views {
377
  self::_update_view_count();
378
 
379
  // Initialize global variables
380
- global $pt_cv_glb, $pt_cv_id;
381
  $pt_cv_glb = array();
 
382
  $pt_cv_id = 0;
383
  }
384
 
351
  PT_CV_Html::frontend_scripts();
352
  }
353
  }
354
+
355
+ do_action( PT_CV_PREFIX_ . 'enqueue_assets' );
356
  }
357
 
358
  /**
379
  self::_update_view_count();
380
 
381
  // Initialize global variables
382
+ global $pt_cv_glb, $pt_cv_views, $pt_cv_id;
383
  $pt_cv_glb = array();
384
+ $pt_cv_views = array();
385
  $pt_cv_id = 0;
386
  }
387