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

Version Description

  • Bug fixed: Pagination returns Empty settings
  • Improvement: UI improvement (Add icon to tabs. Show shortcode in text field for easier selecting. )
  • Improvement: Assets loading improvement
Download this release

Release Info

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

Code changes from version 1.2.6 to 1.3.0

README.txt CHANGED
@@ -1,26 +1,25 @@
1
  === Query posts and display posts in responsive grid layout without coding - Content Views ===
2
  Contributors: pt-guy
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
4
- Tags: post, posts, page, pages, query, queries, search, display, show, shortcode, thumbnail, title, content, excerpt, meta, date, author, term, taxonomy, pagination, grid, scrollable, collapsible, list, slide, layout, ui
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
- Stable tag: 1.2.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Query and display posts in responsive grid, list layouts easier than ever, without coding!
12
 
13
  == Description ==
14
 
15
- Have you ever wanted to:
16
 
17
- * display multiple posts in responsive grid layout at home page
18
- * display multiple posts in responsive grid layout at a specific page
19
- * display posts in descending order of Title
 
20
  * replace boring Next, Prev button of WordPress theme by a beautiful pagination
21
  * display thumbnail in different size than 150x150 or 300x300
22
- * display posts of a specific author
23
- * display posts which have a specific tag or in a specific category
24
  ?
25
 
26
  How do you do?
@@ -29,21 +28,21 @@ It is not easy as ABC, isn't it?
29
 
30
  But now, with Content Views plugin, you can do above things in minutes, without any line of code.
31
 
32
- [Content Views plugin](http://www.contentviewspro.com/?utm_source=wordpress&utm_medium=post&utm_campaign=content-views "Visit Content Views website") provides an intuitive form to query posts and display posts in **responsive** layouts (grid, scrollable list, collapsible list) quickly & easily, in very 3 simple steps:
33
 
34
- * Step 1 : Select criteria (author, category, tag...) to query your wanted posts
35
- * Step 2 : Select a responsive layout to display posts
36
- * Step 3 : Paste shortcode **[pt_view id="UNIQUE_ID"]** to editor of a page, to a Text widget where you want to display your posts. If you are a developer, you can **`<?php echo do_shortcode('[pt_view id="UNIQUE_ID"]'); ?>`** in current theme of your WordPress site. (Please check FAQ to know how to get UNIQUE_ID of View)
37
 
38
  = A features list of Content Views plugin: =
39
 
40
  **in Step 1, you can:**
41
 
42
  * query single/multiple post(s)
 
 
43
  * query child pages of a parent page
44
- * query posts written by, not written by authors
45
- * query posts associate with, not associate with categories, tags
46
- * query posts in any status (publish, draft, private...)
47
  * query posts which contain a specific keyword
48
  * sort posts by Id, Title, Created date, Modified date in ascending, descending order
49
 
@@ -52,7 +51,7 @@ But now, with Content Views plugin, you can do above things in minutes, without
52
  * Select a responsive layout to display posts: Grid, List(Collapsible/Scrollable). More awesome layouts are available in **[Content Views PRO](http://www.contentviewspro.com/?utm_source=wordpress&utm_medium=plugin&utm_campaign=content-views "Content Views Pro plugin")**
53
  * Display fields (thumbnail, title, content, meta fields) in vertical direction. Or display thumbnail in left/right side of other fields
54
  * Select what fields (thumbnail, title, content, meta fields) to display
55
- * Select thumbnail size
56
  * Display full content, or display only excerpt with specific amount of words
57
  * Select what meta fields (date, author, terms [categories, tags], comment count) to display
58
  * Enable/Disable pagination
@@ -63,15 +62,16 @@ Also, you can import/export 'View' to use in other WordPress sites (Please check
63
 
64
  = More amazing features: =
65
 
 
66
  * WooCommerce support
67
  * Portfolio support
68
  * Display posts in more Awesome layouts: Pinterest, Timeline
69
- * More beautiful output & powerful settings of Grid, List
70
  * Drag & drop to change display order of fields (thumbnail, title, content, meta fields)
71
- * Customize Font settings for Title, Content, Meta fields
72
  * Custom style for Thumbnail: round, circle, border
73
  * Customize style & text of "Read more" button
74
- * "Load more" button for pagination
75
  * And much more...
76
 
77
  are available in **[Content Views PRO](http://www.contentviewspro.com/?utm_source=wordpress&utm_medium=plugin&utm_campaign=content-views "Content Views Pro")** plugin.
@@ -126,10 +126,6 @@ If you have View ID or View title, paste it to the text field beside of "Search
126
  Then click on Title of View you want to edit.
127
  You will be forwarded to editing page of View.
128
 
129
- = How to get UNIQUE_ID of View? =
130
-
131
- You can get View ID in URL of editing page of View (please check above question), it has this format: http://your_domain/wp-admin/admin.php?page=content-views-add&id=UNIQUE_ID
132
-
133
  = How many Views I can create? =
134
 
135
  You can create Unlimited Views, in Unlimited websites
@@ -148,6 +144,11 @@ You can create Unlimited Views, in Unlimited websites
148
 
149
  == Changelog ==
150
 
 
 
 
 
 
151
  = 1.2.6 =
152
  * Fix bug: javascript error of missing function
153
  * Update description for some options
@@ -224,6 +225,9 @@ You can create Unlimited Views, in Unlimited websites
224
 
225
  == Upgrade Notice ==
226
 
 
 
 
227
  = 1.2.6 =
228
  Fix bug: javascript error of missing function. Update description for some options. Update styles
229
 
1
  === Query posts and display posts in responsive grid layout without coding - Content Views ===
2
  Contributors: pt-guy
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
4
+ Tags: post, posts, page, pages, query, queries, search, display, show, shortcode, thumbnail, title, content, excerpt, meta, date, author, term, taxonomy, pagination, grid, scrollable, slider, collapsible, list, slide, layout, ui
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
+ Stable tag: 1.3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Query and display posts by category, tag, author... in responsive grid, list layouts easier than ever, without coding!
12
 
13
  == Description ==
14
 
15
+ Have you ever wanted to display posts by category, on your WordPress homepage in responsive grid layout, or:
16
 
17
+ * display posts in grid layout in a page
18
+ * display posts by tag
19
+ * display posts by author
20
+ * sort posts in descending order of Title
21
  * replace boring Next, Prev button of WordPress theme by a beautiful pagination
22
  * display thumbnail in different size than 150x150 or 300x300
 
 
23
  ?
24
 
25
  How do you do?
28
 
29
  But now, with Content Views plugin, you can do above things in minutes, without any line of code.
30
 
31
+ [Content Views plugin](http://www.contentviewspro.com/?utm_source=wordpress&utm_medium=post&utm_campaign=content-views "Get Content Views Pro") provides an intuitive form to query posts and display posts in **responsive** layouts (grid layout, scrollable list/slider, accordion/collapsible list) quickly & easily, in very 3 simple steps:
32
 
33
+ * Step 1 : Choose filters (author, category/tag, order...) to query your posts
34
+ * Step 2 : Customize display options to display posts in a responsive layout
35
+ * Step 3 : Save View. You will see a shortcode **[pt_view id="UNIQUE_ID"]** at top of page, paste it to editor of a page or to a Text widget where you want to display your posts. If you are a developer, you can **`<?php echo do_shortcode('[pt_view id="UNIQUE_ID"]'); ?>`** in your WordPress theme.
36
 
37
  = A features list of Content Views plugin: =
38
 
39
  **in Step 1, you can:**
40
 
41
  * query single/multiple post(s)
42
+ * query posts by category, tag
43
+ * query posts by author
44
  * query child pages of a parent page
45
+ * query posts by status (publish, draft, private...)
 
 
46
  * query posts which contain a specific keyword
47
  * sort posts by Id, Title, Created date, Modified date in ascending, descending order
48
 
51
  * Select a responsive layout to display posts: Grid, List(Collapsible/Scrollable). More awesome layouts are available in **[Content Views PRO](http://www.contentviewspro.com/?utm_source=wordpress&utm_medium=plugin&utm_campaign=content-views "Content Views Pro plugin")**
52
  * Display fields (thumbnail, title, content, meta fields) in vertical direction. Or display thumbnail in left/right side of other fields
53
  * Select what fields (thumbnail, title, content, meta fields) to display
54
+ * Select thumbnail sizes
55
  * Display full content, or display only excerpt with specific amount of words
56
  * Select what meta fields (date, author, terms [categories, tags], comment count) to display
57
  * Enable/Disable pagination
62
 
63
  = More amazing features: =
64
 
65
+ * Completely replace WordPress layout in Category page, Author page, Search page by Grid layout
66
  * WooCommerce support
67
  * Portfolio support
68
  * Display posts in more Awesome layouts: Pinterest, Timeline
69
+ * More beautiful output & powerful settings for Grid, List layout
70
  * Drag & drop to change display order of fields (thumbnail, title, content, meta fields)
71
+ * Customize Font, Color settings for Title, Content, Meta fields
72
  * Custom style for Thumbnail: round, circle, border
73
  * Customize style & text of "Read more" button
74
+ * AJAX "Load more" button for pagination
75
  * And much more...
76
 
77
  are available in **[Content Views PRO](http://www.contentviewspro.com/?utm_source=wordpress&utm_medium=plugin&utm_campaign=content-views "Content Views Pro")** plugin.
126
  Then click on Title of View you want to edit.
127
  You will be forwarded to editing page of View.
128
 
 
 
 
 
129
  = How many Views I can create? =
130
 
131
  You can create Unlimited Views, in Unlimited websites
144
 
145
  == Changelog ==
146
 
147
+ = 1.3.0 =
148
+ * Bug fixed: Pagination returns Empty settings
149
+ * Improvement: UI improvement (Add icon to tabs. Show shortcode in text field for easier selecting. )
150
+ * Improvement: Assets loading improvement
151
+
152
  = 1.2.6 =
153
  * Fix bug: javascript error of missing function
154
  * Update description for some options
225
 
226
  == Upgrade Notice ==
227
 
228
+ = 1.3.0 =
229
+ Bug fixed: Pagination returns Empty settings. Improvement: UI improvement (Add icon to tabs. Show shortcode in text field for easier selecting. ). Improvement: Assets loading improvement
230
+
231
  = 1.2.6 =
232
  Fix bug: javascript error of missing function. Update description for some options. Update styles
233
 
admin/assets/css/admin.css CHANGED
@@ -34,7 +34,7 @@ html {
34
 
35
  .pt-wrap .text-muted {
36
  clear: both;
37
- margin: 4px 0;
38
  float: left;
39
  }
40
 
@@ -60,10 +60,18 @@ html {
60
  display: none;
61
  }
62
 
 
 
 
 
63
  #pt-cv-form-view *, .preview-wrapper label {
64
  font-size: 14px;
65
  }
66
 
 
 
 
 
67
  .pt-wrap h2 {
68
  margin-bottom: 20px;
69
  }
@@ -73,7 +81,7 @@ html {
73
  }
74
 
75
  .pt-wrap .form-group.pt-form-group {
76
- margin-bottom: 5px;
77
  }
78
 
79
  .pt-cv-color {
@@ -93,7 +101,7 @@ html {
93
  padding: 10px 15px;
94
  }
95
 
96
- .pt-cv-group .control-label {
97
  font-weight: 400;
98
  }
99
 
34
 
35
  .pt-wrap .text-muted {
36
  clear: both;
37
+ margin: 2px 0;
38
  float: left;
39
  }
40
 
60
  display: none;
61
  }
62
 
63
+ #pt-cv-form-view .nav .glyphicon {
64
+ margin-right: 6px;
65
+ }
66
+
67
  #pt-cv-form-view *, .preview-wrapper label {
68
  font-size: 14px;
69
  }
70
 
71
+ .preview-wrapper .text-muted {
72
+ margin-top: 8px;
73
+ }
74
+
75
  .pt-wrap h2 {
76
  margin-bottom: 20px;
77
  }
81
  }
82
 
83
  .pt-wrap .form-group.pt-form-group {
84
+ margin-bottom: 8px;
85
  }
86
 
87
  .pt-cv-color {
101
  padding: 10px 15px;
102
  }
103
 
104
+ .pt-cv-group .control-label, .pt-form-group .pt-form-group .control-label {
105
  font-weight: 400;
106
  }
107
 
admin/assets/js/admin.js CHANGED
@@ -85,24 +85,6 @@
85
  $taxonomy_relation.addClass('hidden');
86
  }
87
  },
88
- /**
89
- * Color picker element
90
- *
91
- * @param {type} picker_el
92
- * @returns {undefined}
93
- */
94
- _color_picker : function (picker_el) {
95
- $(picker_el).click(function (e) {
96
- var colorPicker = $(this).next('div');
97
- var input = $(this);
98
- $(colorPicker).farbtastic(input);
99
- colorPicker.show();
100
- e.preventDefault();
101
- $(document).mousedown(function () {
102
- $(colorPicker).hide();
103
- });
104
- });
105
- },
106
  /**
107
  * Get field value, depends on field type & its parent is show/hide
108
  *
@@ -333,20 +315,13 @@
333
  $self._do_toggle_taxonomy_relation($taxonomy_relation, $wrap_taxonomies);
334
  }
335
 
336
- // Show taxonomies which theirs value have this format {this_val}_
337
  if (this_val !== '') {
338
  fn_taxonomy_hide($taxonomies);
339
  $taxonomies.filter(function () {
340
  var val = $(this).val();
341
- return val.substr(0, this_val.length) === this_val;
342
- }).parents('.checkbox').removeClass('hidden');
343
- }
344
-
345
- // Show Category if Content Type = Post
346
- if (this_val === 'post') {
347
- $taxonomies.filter(function () {
348
- var val = $(this).val();
349
- return val === 'category';
350
  }).parents('.checkbox').removeClass('hidden');
351
  }
352
 
@@ -468,10 +443,6 @@
468
  type : "POST",
469
  url : ajaxurl,
470
  data : data,
471
- beforeSend: function () {
472
- // Show loading icon
473
- // preview_box.next().toggleClass('hidden');
474
- },
475
  }).done(function (response) {
476
  preview_box.css('opacity', '1');
477
  // Hide loading icon
@@ -635,7 +606,7 @@
635
  $self._toggle_panel('.' + _prefix + 'group .panel-heading');
636
 
637
  // Color picker
638
- $self._color_picker('.' + _prefix + 'color');
639
 
640
  // 'Thumbnail settings' toggle
641
  $self._thumbnail_settings();
85
  $taxonomy_relation.addClass('hidden');
86
  }
87
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  /**
89
  * Get field value, depends on field type & its parent is show/hide
90
  *
315
  $self._do_toggle_taxonomy_relation($taxonomy_relation, $wrap_taxonomies);
316
  }
317
 
318
+ // Show taxonomies relates to selected post type
319
  if (this_val !== '') {
320
  fn_taxonomy_hide($taxonomies);
321
  $taxonomies.filter(function () {
322
  var val = $(this).val();
323
+ var $taxonomies_of_this = PT_CV_ADMIN.data.post_types_vs_taxonomies[this_val] || '';
324
+ return $.inArray(val, $taxonomies_of_this) >= 0;
 
 
 
 
 
 
 
325
  }).parents('.checkbox').removeClass('hidden');
326
  }
327
 
443
  type : "POST",
444
  url : ajaxurl,
445
  data : data,
 
 
 
 
446
  }).done(function (response) {
447
  preview_box.css('opacity', '1');
448
  // Hide loading icon
606
  $self._toggle_panel('.' + _prefix + 'group .panel-heading');
607
 
608
  // Color picker
609
+ $('.' + _prefix + 'color').wpColorPicker();
610
 
611
  // 'Thumbnail settings' toggle
612
  $self._thumbnail_settings();
admin/content-views-admin.php CHANGED
@@ -166,7 +166,7 @@ class PT_Content_Views_Admin {
166
  // WP assets
167
  wp_enqueue_style( 'thickbox' );
168
  wp_enqueue_style( 'media-upload' );
169
- wp_enqueue_style( 'farbtastic' );
170
 
171
  // Main admin style
172
  PT_CV_Asset::enqueue(
@@ -219,7 +219,7 @@ class PT_Content_Views_Admin {
219
  if ( $this->plugin_screen_hook_suffix == $screen->id || in_array( $screen->id, $this->plugin_sub_screen_hook_suffix ) ) {
220
 
221
  // WP assets
222
- wp_enqueue_script( 'farbtastic' );
223
  wp_enqueue_script( 'jquery-ui-sortable' );
224
 
225
  // Main admin script
@@ -245,6 +245,9 @@ class PT_Content_Views_Admin {
245
  'update' => __( 'Update Preview', PT_CV_DOMAIN ),
246
  ),
247
  ),
 
 
 
248
  )
249
  );
250
 
166
  // WP assets
167
  wp_enqueue_style( 'thickbox' );
168
  wp_enqueue_style( 'media-upload' );
169
+ wp_enqueue_style( 'wp-color-picker' );
170
 
171
  // Main admin style
172
  PT_CV_Asset::enqueue(
219
  if ( $this->plugin_screen_hook_suffix == $screen->id || in_array( $screen->id, $this->plugin_sub_screen_hook_suffix ) ) {
220
 
221
  // WP assets
222
+ wp_enqueue_script( 'wp-color-picker' );
223
  wp_enqueue_script( 'jquery-ui-sortable' );
224
 
225
  // Main admin script
245
  'update' => __( 'Update Preview', PT_CV_DOMAIN ),
246
  ),
247
  ),
248
+ 'data' => array(
249
+ 'post_types_vs_taxonomies' => PT_CV_Values::post_types_vs_taxonomies(),
250
+ ),
251
  )
252
  );
253
 
admin/includes/options.php CHANGED
@@ -121,7 +121,7 @@ if ( ! class_exists( 'PT_Options_Framework' ) ) {
121
  $for = isset( $label['for'] ) ? "for='{$label['for']}'" : '';
122
  $width = 12 - ( isset( $extra_setting['params']['width'] ) ? intval( $extra_setting['params']['width'] ) : 10 );
123
  if ( $width ) {
124
- $html = "<label $for class='col-sm-$width control-label'>" . __( $label['text'], PT_CV_DOMAIN ) . '</label>';
125
  } else {
126
  $html = '';
127
  }
@@ -144,7 +144,7 @@ if ( ! class_exists( 'PT_Options_Framework' ) ) {
144
  $param_wrap_id = isset( $extra_setting['params']['wrap-id'] ) ? "id='" . esc_attr( $extra_setting['params']['wrap-id'] ) . "'" : '';
145
  $width = isset( $extra_setting['params']['width'] ) ? intval( $extra_setting['params']['width'] ) : 10;
146
 
147
- return "<div class='col-sm-$width pt-params $param_wrap_class' $param_wrap_id>$html</div>";
148
  }
149
 
150
  /**
@@ -281,13 +281,8 @@ if ( ! class_exists( 'PT_Options_Framework' ) ) {
281
  $html .= "<select name='$name' class='$class' $multiple $id $extend>$options</select>";
282
  }
283
  break;
284
- case 'font_color':
285
- $html .= "<div class='form-inline font-color'>";
286
- $font = self::field_type( $param['options']['font'], $data );
287
- $html .= "<div class='input-group'>$font<span class='input-group-addon'>px</span></div>";
288
- $color = self::field_type( $param['options']['color'], $data );
289
- $html .= "<div class='form-group'>$color</div>";
290
- $html .= '</div>';
291
  break;
292
  case 'html':
293
  if ( isset( $param['content'] ) ) {
121
  $for = isset( $label['for'] ) ? "for='{$label['for']}'" : '';
122
  $width = 12 - ( isset( $extra_setting['params']['width'] ) ? intval( $extra_setting['params']['width'] ) : 10 );
123
  if ( $width ) {
124
+ $html = "<label $for class='col-md-$width control-label'>" . __( $label['text'], PT_CV_DOMAIN ) . '</label>';
125
  } else {
126
  $html = '';
127
  }
144
  $param_wrap_id = isset( $extra_setting['params']['wrap-id'] ) ? "id='" . esc_attr( $extra_setting['params']['wrap-id'] ) . "'" : '';
145
  $width = isset( $extra_setting['params']['width'] ) ? intval( $extra_setting['params']['width'] ) : 10;
146
 
147
+ return "<div class='col-md-$width pt-params $param_wrap_class' $param_wrap_id>$html</div>";
148
  }
149
 
150
  /**
281
  $html .= "<select name='$name' class='$class' $multiple $id $extend>$options</select>";
282
  }
283
  break;
284
+ case 'color_picker':
285
+ $html .= self::field_type( $param['options'], $data );
 
 
 
 
 
286
  break;
287
  case 'html':
288
  if ( isset( $param['content'] ) ) {
admin/views/view.php CHANGED
@@ -43,7 +43,7 @@ PT_CV_Functions::view_submit();
43
 
44
  <?php
45
  if ( $id ) {
46
- echo balanceTags( sprintf( '<div class="alert alert-success" style="color: #000">[pt_view id="%s"]</div>', $id ) );
47
  }
48
  ?>
49
 
@@ -116,10 +116,10 @@ echo balanceTags( PT_Options_Framework::do_settings( $options, $settings ) );
116
  <!-- Nav tabs -->
117
  <ul class="nav nav-tabs">
118
  <li class="active">
119
- <a href="#<?php echo esc_attr( PT_CV_PREFIX ); ?>filter-settings" data-toggle="tab"><?php _e( 'Filter Settings', PT_CV_DOMAIN ); ?></a>
120
  </li>
121
  <li>
122
- <a href="#<?php echo esc_attr( PT_CV_PREFIX ); ?>display-settings" data-toggle="tab"><?php _e( 'Display Settings', PT_CV_DOMAIN ); ?></a>
123
  </li>
124
  <?php do_action( PT_CV_PREFIX_ . 'setting_tabs_header', $settings ); ?>
125
  </ul>
@@ -161,6 +161,8 @@ $options = array(
161
  'type' => 'group',
162
  'params' => array(
163
 
 
 
164
  // Includes
165
  array(
166
  'label' => array(
@@ -186,7 +188,7 @@ $options = array(
186
  'type' => 'text',
187
  'name' => 'post__not_in',
188
  'std' => '',
189
- 'desc' => __( 'List of ids (comma-separated values) of posts to exclude from view', PT_CV_DOMAIN ),
190
  ),
191
  ),
192
  ),
@@ -218,6 +220,7 @@ $options = array(
218
  'name' => 'limit',
219
  'std' => '10',
220
  'min' => '1',
 
221
  'desc' => __( 'The number of posts to show. Leaving it blank to show all found posts (which match all settings)', PT_CV_DOMAIN ),
222
  ),
223
  ),
@@ -284,41 +287,6 @@ $options = array(
284
  'type' => 'panel_group',
285
  'params' => array(
286
 
287
- // Author Settings
288
- 'author' => array(
289
- array(
290
- 'label' => array(
291
- 'text' => __( 'Written by', PT_CV_DOMAIN ),
292
- ),
293
- 'params' => array(
294
- array(
295
- 'type' => 'select',
296
- 'name' => 'author__in[]',
297
- 'options' => PT_CV_Values::user_list(),
298
- 'std' => '',
299
- 'class' => 'select2',
300
- 'multiple' => $version_gt_37 ? '1' : '0',
301
- ),
302
- ),
303
- ),
304
- $version_gt_37 ?
305
- array(
306
- 'label' => array(
307
- 'text' => __( 'Not written by', PT_CV_DOMAIN ),
308
- ),
309
- 'params' => array(
310
- array(
311
- 'type' => 'select',
312
- 'name' => 'author__not_in[]',
313
- 'options' => PT_CV_Values::user_list(),
314
- 'std' => '',
315
- 'class' => 'select2',
316
- 'multiple' => $version_gt_37 ? '1' : '0',
317
- ),
318
- ),
319
- ) : array(),
320
- ), // End Author Settings
321
-
322
  // Taxonomies Settings
323
  'taxonomy' => array(
324
 
@@ -402,6 +370,41 @@ $options = array(
402
  ),
403
  ), // End Order by Settings
404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  // Status Settings
406
  'status' => array(
407
  array(
43
 
44
  <?php
45
  if ( $id ) {
46
+ echo balanceTags( sprintf( '<input type="text" value="[pt_view id=&quot;%s&quot;]" onclick="this.select()" readonly="" class="form-control" style="background: #ADFFAD; margin-bottom: 20px;">', $id ) );
47
  }
48
  ?>
49
 
116
  <!-- Nav tabs -->
117
  <ul class="nav nav-tabs">
118
  <li class="active">
119
+ <a href="#<?php echo esc_attr( PT_CV_PREFIX ); ?>filter-settings" data-toggle="tab"><span class="glyphicon glyphicon-search"></span><?php _e( 'Filter Settings', PT_CV_DOMAIN ); ?></a>
120
  </li>
121
  <li>
122
+ <a href="#<?php echo esc_attr( PT_CV_PREFIX ); ?>display-settings" data-toggle="tab"><span class="glyphicon glyphicon-th-large"></span><?php _e( 'Display Settings', PT_CV_DOMAIN ); ?></a>
123
  </li>
124
  <?php do_action( PT_CV_PREFIX_ . 'setting_tabs_header', $settings ); ?>
125
  </ul>
161
  'type' => 'group',
162
  'params' => array(
163
 
164
+ apply_filters( PT_CV_PREFIX_ . 'exclude_sticky_posts_setting', array() ),
165
+
166
  // Includes
167
  array(
168
  'label' => array(
188
  'type' => 'text',
189
  'name' => 'post__not_in',
190
  'std' => '',
191
+ 'desc' => __( 'List of ids (comma-separated values) of posts to exclude from output', PT_CV_DOMAIN ),
192
  ),
193
  ),
194
  ),
220
  'name' => 'limit',
221
  'std' => '10',
222
  'min' => '1',
223
+ 'append_text' => '1 &rarr; 999',
224
  'desc' => __( 'The number of posts to show. Leaving it blank to show all found posts (which match all settings)', PT_CV_DOMAIN ),
225
  ),
226
  ),
287
  'type' => 'panel_group',
288
  'params' => array(
289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  // Taxonomies Settings
291
  'taxonomy' => array(
292
 
370
  ),
371
  ), // End Order by Settings
372
 
373
+ // Author Settings
374
+ 'author' => array(
375
+ array(
376
+ 'label' => array(
377
+ 'text' => __( 'Written by', PT_CV_DOMAIN ),
378
+ ),
379
+ 'params' => array(
380
+ array(
381
+ 'type' => 'select',
382
+ 'name' => 'author__in[]',
383
+ 'options' => PT_CV_Values::user_list(),
384
+ 'std' => '',
385
+ 'class' => 'select2',
386
+ 'multiple' => $version_gt_37 ? '1' : '0',
387
+ ),
388
+ ),
389
+ ),
390
+ $version_gt_37 ?
391
+ array(
392
+ 'label' => array(
393
+ 'text' => __( 'Not written by', PT_CV_DOMAIN ),
394
+ ),
395
+ 'params' => array(
396
+ array(
397
+ 'type' => 'select',
398
+ 'name' => 'author__not_in[]',
399
+ 'options' => PT_CV_Values::user_list(),
400
+ 'std' => '',
401
+ 'class' => 'select2',
402
+ 'multiple' => $version_gt_37 ? '1' : '0',
403
+ ),
404
+ ),
405
+ ) : array(),
406
+ ), // End Author Settings
407
+
408
  // Status Settings
409
  'status' => array(
410
  array(
content-views.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
- * Version: 1.2.6
14
  * Author: Palace Of Themes
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views
@@ -27,7 +27,7 @@ if ( ! defined( 'WPINC' ) ) {
27
  /*
28
  * Define Constant
29
  */
30
- define( 'PT_CV_VERSION', '1.2.6' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  include_once( plugin_dir_path( __FILE__ ) . 'includes/defines.php' );
33
 
@@ -82,6 +82,7 @@ if ( is_admin() ) {
82
  }
83
 
84
  add_action( 'init', array( 'PT_CV_Functions', 'session_start' ), 1 );
 
85
 
86
  /**
87
  * Common settings
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
+ * Version: 1.3.0
14
  * Author: Palace Of Themes
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views
27
  /*
28
  * Define Constant
29
  */
30
+ define( 'PT_CV_VERSION', '1.3.0' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  include_once( plugin_dir_path( __FILE__ ) . 'includes/defines.php' );
33
 
82
  }
83
 
84
  add_action( 'init', array( 'PT_CV_Functions', 'session_start' ), 1 );
85
+ add_action( 'admin_notices', array( 'PT_CV_Functions', 'util_show_promotion' ), 1 );
86
 
87
  /**
88
  * Common settings
includes/functions.php CHANGED
@@ -358,7 +358,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
358
  'post_type' => PT_CV_POST_TYPE,
359
  'post_status' => 'publish',
360
  'meta_key' => PT_CV_META_ID,
361
- 'meta_value' => $meta_id,
362
  )
363
  );
364
  if ( $pt_query->have_posts() ) :
@@ -479,54 +479,8 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
479
  }
480
 
481
  if ( empty( $args ) || empty( $dargs ) ) {
482
- /**
483
- * Get Query parameters
484
- * Set default values
485
- */
486
- $args = array(
487
- 'post_type' => $content_type,
488
- 'post_status' => 'publish',
489
- 'ignore_sticky_posts' => 1,
490
- );
491
-
492
- // Post in
493
- if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__in', $pt_view_settings ) ) {
494
- $post_in = PT_CV_Functions::string_to_array( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__in', $pt_view_settings ) );
495
- $args['post__in'] = array_map( 'intval', array_filter( $post_in ) );
496
- }
497
-
498
- // Post not in
499
- if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__not_in', $pt_view_settings ) ) {
500
- $post_not_in = PT_CV_Functions::string_to_array( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__not_in', $pt_view_settings ) );
501
- $args['post__not_in'] = array_map( 'intval', array_filter( $post_not_in ) );
502
- }
503
-
504
- // Parent page
505
- if ( $content_type == 'page' ) {
506
- $post_parent = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post_parent', $pt_view_settings );
507
- if ( ! empty( $post_parent ) ) {
508
- $args['post_parent'] = (int) $post_parent;
509
- }
510
- }
511
-
512
- // Advance settings
513
- PT_CV_Functions::view_get_advanced_settings( $args, $content_type );
514
-
515
- /**
516
- * Get Display parameters
517
- */
518
- $dargs = array();
519
-
520
- $dargs['view-type'] = $view_type;
521
-
522
- // Field settings of a item
523
- PT_CV_Functions::view_get_display_settings( $dargs );
524
-
525
- // Other settings
526
- PT_CV_Functions::view_get_other_settings( $dargs );
527
-
528
- // View type settings
529
- $dargs['view-type-settings'] = PT_CV_Functions::settings_values_by_prefix( PT_CV_PREFIX . $view_type . '-' );
530
 
531
  // Filter
532
  $dargs = apply_filters( PT_CV_PREFIX_ . 'all_display_settings', $dargs );
@@ -595,7 +549,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
595
  wp_reset_postdata();
596
 
597
  // Filter array of items
598
- $content_items = apply_filters( PT_CV_PREFIX_ . 'content_items', $content_items );;
599
 
600
  /**
601
  * Output Pagination
@@ -620,6 +574,78 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
620
  return $html;
621
  }
622
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623
  /**
624
  * Get Advance settings
625
  *
@@ -753,6 +779,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
753
  // Use 'meta_value_num' for numeric values
754
  global $pt_content_type;
755
  $all_meta_numeric_values = apply_filters( PT_CV_PREFIX_ . 'meta_numeric_values', array() );
 
756
  // Get numeric values of selected content type
757
  $meta_numeric_values = isset( $all_meta_numeric_values[$pt_content_type] ) ? $all_meta_numeric_values[$pt_content_type] : array();
758
  $meta_orderby = array_key_exists( $meta_key, (array) $meta_numeric_values ) ? 'meta_value_num' : 'meta_value';
@@ -764,9 +791,9 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
764
 
765
  } else {
766
  // Common order by
767
-
768
  $orderby = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'orderby', $pt_view_settings );
769
  $order_by_options = array_keys( PT_CV_Values::post_regular_orderby() );
 
770
  if ( in_array( $orderby, $order_by_options ) ) {
771
  $order_settings = array(
772
  'orderby' => $orderby,
@@ -1072,7 +1099,10 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
1072
  // Session id
1073
  $sid = esc_sql( empty( $_POST['sid'] ) ? '' : $_POST['sid'] );
1074
 
1075
- $post_fix = is_admin() ? '' : '_frontend';
 
 
 
1076
 
1077
  // Get saved $settings
1078
  if ( isset( $_SESSION[PT_CV_PREFIX . 'settings' . $post_fix] ) ) {
@@ -1090,6 +1120,29 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
1090
  // Must exit
1091
  die;
1092
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1093
  }
1094
 
1095
  }
358
  'post_type' => PT_CV_POST_TYPE,
359
  'post_status' => 'publish',
360
  'meta_key' => PT_CV_META_ID,
361
+ 'meta_value' => esc_sql( $meta_id ),
362
  )
363
  );
364
  if ( $pt_query->have_posts() ) :
479
  }
480
 
481
  if ( empty( $args ) || empty( $dargs ) ) {
482
+ $args = PT_CV_Functions::view_filter_settings( $content_type, $pt_view_settings );
483
+ $dargs = PT_CV_Functions::view_display_settings( $view_type );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
 
485
  // Filter
486
  $dargs = apply_filters( PT_CV_PREFIX_ . 'all_display_settings', $dargs );
549
  wp_reset_postdata();
550
 
551
  // Filter array of items
552
+ $content_items = apply_filters( PT_CV_PREFIX_ . 'content_items', $content_items );
553
 
554
  /**
555
  * Output Pagination
574
  return $html;
575
  }
576
 
577
+ /**
578
+ * Get query parameters of View
579
+ *
580
+ * @param string $content_type The current content type
581
+ * @param array $pt_view_settings The settings of View
582
+ * @return array
583
+ */
584
+ static function view_filter_settings( $content_type, $pt_view_settings ) {
585
+ /**
586
+ * Get Query parameters
587
+ * Set default values
588
+ */
589
+ $args = array(
590
+ 'post_type' => $content_type,
591
+ 'post_status' => 'publish',
592
+ 'ignore_sticky_posts' => 1,
593
+ );
594
+
595
+ // Post in
596
+ if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__in', $pt_view_settings ) ) {
597
+ $post_in = PT_CV_Functions::string_to_array( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__in', $pt_view_settings ) );
598
+ $args['post__in'] = array_map( 'intval', array_filter( $post_in ) );
599
+ }
600
+
601
+ // Post not in
602
+ if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__not_in', $pt_view_settings ) ) {
603
+ $post_not_in = PT_CV_Functions::string_to_array( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__not_in', $pt_view_settings ) );
604
+ $args['post__not_in'] = array_map( 'intval', array_filter( $post_not_in ) );
605
+ }
606
+
607
+ $args['post__not_in'] = apply_filters( PT_CV_PREFIX_ . 'post__not_in', isset( $args['post__not_in'] ) ? $args['post__not_in'] : array(), $pt_view_settings );
608
+
609
+ // Parent page
610
+ if ( $content_type == 'page' ) {
611
+ $post_parent = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post_parent', $pt_view_settings );
612
+ if ( ! empty( $post_parent ) ) {
613
+ $args['post_parent'] = (int) $post_parent;
614
+ }
615
+ }
616
+
617
+ // Advance settings
618
+ PT_CV_Functions::view_get_advanced_settings( $args, $content_type );
619
+
620
+ return $args;
621
+ }
622
+
623
+ /**
624
+ * Get display parameters of View
625
+ *
626
+ * @param string $view_type The view type of View
627
+ * @return array
628
+ */
629
+ static function view_display_settings( $view_type ) {
630
+ /**
631
+ * Get Display parameters
632
+ */
633
+ $dargs = array();
634
+
635
+ $dargs['view-type'] = $view_type;
636
+
637
+ // Field settings of a item
638
+ PT_CV_Functions::view_get_display_settings( $dargs );
639
+
640
+ // Other settings
641
+ PT_CV_Functions::view_get_other_settings( $dargs );
642
+
643
+ // View type settings
644
+ $dargs['view-type-settings'] = PT_CV_Functions::settings_values_by_prefix( PT_CV_PREFIX . $view_type . '-' );
645
+
646
+ return $dargs;
647
+ }
648
+
649
  /**
650
  * Get Advance settings
651
  *
779
  // Use 'meta_value_num' for numeric values
780
  global $pt_content_type;
781
  $all_meta_numeric_values = apply_filters( PT_CV_PREFIX_ . 'meta_numeric_values', array() );
782
+
783
  // Get numeric values of selected content type
784
  $meta_numeric_values = isset( $all_meta_numeric_values[$pt_content_type] ) ? $all_meta_numeric_values[$pt_content_type] : array();
785
  $meta_orderby = array_key_exists( $meta_key, (array) $meta_numeric_values ) ? 'meta_value_num' : 'meta_value';
791
 
792
  } else {
793
  // Common order by
 
794
  $orderby = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'orderby', $pt_view_settings );
795
  $order_by_options = array_keys( PT_CV_Values::post_regular_orderby() );
796
+
797
  if ( in_array( $orderby, $order_by_options ) ) {
798
  $order_settings = array(
799
  'orderby' => $orderby,
1099
  // Session id
1100
  $sid = esc_sql( empty( $_POST['sid'] ) ? '' : $_POST['sid'] );
1101
 
1102
+ // Is admin
1103
+ $is_admin = ! empty( $_POST['is_admin'] ) ? $_POST['is_admin'] : 0;
1104
+
1105
+ $post_fix = $is_admin ? '' : '_frontend';
1106
 
1107
  // Get saved $settings
1108
  if ( isset( $_SESSION[PT_CV_PREFIX . 'settings' . $post_fix] ) ) {
1120
  // Must exit
1121
  die;
1122
  }
1123
+
1124
+ /**
1125
+ * Show Promotion Notices
1126
+ */
1127
+ static function util_show_promotion() {
1128
+ $pro_installed = get_option( 'pt_cv_version_pro' );
1129
+ if ( ! $pro_installed ) {
1130
+ $showed = get_transient( PT_CV_PREFIX_ . 'promotion_shown' );
1131
+
1132
+ // If has not shown within 3 hours. Show it again
1133
+ if ( ! $showed ) {
1134
+ ?>
1135
+ <div class="update-nag wrap" style="display: block; border-left: 4px solid #7ad03a; background-color: #fef7f1;">
1136
+ <h2>30% Off Content Views Pro - YOU SAVE $10 TODAY</h2>
1137
+ <h3>Just $19 - Until July 31, 2014</h3>
1138
+ <a href="http://www.contentviewspro.com/pricing?utm_source=wordpress&utm_medium=notice" target="_blank" class="button button-primary">Get It Now!</a>
1139
+ </div>
1140
+ <?php
1141
+ set_transient( PT_CV_PREFIX_ . 'promotion_shown', 1, 2 * HOUR_IN_SECONDS );
1142
+ }
1143
+ }
1144
+ }
1145
+
1146
  }
1147
 
1148
  }
includes/html-viewtype.php CHANGED
@@ -71,10 +71,15 @@ if ( ! class_exists( 'PT_CV_Html_ViewType' ) ) {
71
  }
72
 
73
  $list_item = implode( "\n", $row_html );
 
74
  if ( $pt_cv_enable_filter != 'yes' ) {
75
- $list_item = sprintf( '<div class="%1$s">%2$s</div>', esc_attr( $row_class ), balanceTags( $list_item ) );
 
 
 
76
  }
77
- $content[] = $list_item;
 
78
  }
79
  }
80
 
@@ -103,12 +108,12 @@ if ( ! class_exists( 'PT_CV_Html_ViewType' ) ) {
103
  }
104
 
105
  // Data attribute
106
- $open_multiple = ( isset( $dargs['view-type-settings']['open-multiple'] ) && $dargs['view-type-settings']['open-multiple'] == 'yes' ) ? 'data-multiple-open="yes"' : '';
107
 
108
  // Collapsible wrapper class
109
  $wrapper_class = apply_filters( PT_CV_PREFIX_ . 'wrapper_collapsible_class', 'panel-group' );
110
 
111
- $output = sprintf( '<div class="%s" id="%s" %s>%s</div>', esc_attr( $wrapper_class ), esc_attr( $random_id ), $open_multiple, balanceTags( implode( "\n", $collapsible_list ) ) );
112
 
113
  $content[] = $output;
114
  }
71
  }
72
 
73
  $list_item = implode( "\n", $row_html );
74
+
75
  if ( $pt_cv_enable_filter != 'yes' ) {
76
+ $list_item = sprintf( '<div class="%1$s">%2$s</div>', esc_attr( $row_class ), $list_item );
77
+ } else {
78
+ // Add the extra clearfix
79
+ $list_item .= '<div class="clearfix visible-xs-block"></div>';
80
  }
81
+
82
+ $content[] = balanceTags( $list_item );
83
  }
84
  }
85
 
108
  }
109
 
110
  // Data attribute
111
+ $data_attr = apply_filters( PT_CV_PREFIX_ . 'collapsible_data_attr', '' );
112
 
113
  // Collapsible wrapper class
114
  $wrapper_class = apply_filters( PT_CV_PREFIX_ . 'wrapper_collapsible_class', 'panel-group' );
115
 
116
+ $output = sprintf( '<div class="%s" id="%s" %s>%s</div>', esc_attr( $wrapper_class ), esc_attr( $random_id ), $data_attr, balanceTags( implode( "\n", $collapsible_list ) ) );
117
 
118
  $content[] = $output;
119
  }
includes/html.php CHANGED
@@ -235,7 +235,8 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
235
  }
236
 
237
  // Get wrapper class of a item
238
- $item_class = apply_filters( PT_CV_PREFIX_ . 'content_item_class', array( $class, PT_CV_PREFIX . 'content-item' ) );
 
239
 
240
  $item_filter = apply_filters( PT_CV_PREFIX_ . 'content_item_filter_value', '', $post_id );
241
 
@@ -414,9 +415,15 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
414
  $content = '';
415
  switch ( $fargs['content']['show'] ) {
416
  case 'excerpt':
417
- $length = (int) $fargs['content']['length'];
418
- $readmore = '<br />' . PT_CV_Html::link_button( get_permalink(), 'success', __( 'Read More', PT_CV_DOMAIN ), PT_CV_PREFIX . 'readmore', 'btn-sm' );
419
- $content = wp_trim_words( strip_shortcodes( get_the_content() ), $length, ' ...' . apply_filters( PT_CV_PREFIX_ . 'field_content_readmore', $readmore, $fargs['content'], get_permalink() ) );
 
 
 
 
 
 
420
  break;
421
 
422
  case 'full':
@@ -562,41 +569,44 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
562
  switch ( $meta ) {
563
  case 'date':
564
  // Get date wrapper class
565
- $date_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_date_class', 'entry-date' );
 
566
 
567
- $html['date'] = sprintf( '<span class="%1$s"><time datetime="%2$s">%3$s</time></span>', esc_html( $date_class ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) );
568
  break;
569
 
570
  case 'taxonomy':
571
 
572
  // Get terms wrapper class
573
- $term_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_terms_class', 'terms' );
 
574
 
575
  $terms = PT_CV_Functions::post_terms( $post );
576
  if ( ! empty( $terms ) ) {
577
- $html['taxonomy'] = sprintf( '<span class="%s">%s %s</span>', esc_attr( $term_class ), __( 'in', PT_CV_DOMAIN ), balanceTags( $terms ) );
578
  }
579
  break;
580
 
581
  case 'comment':
582
  if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
583
  // Get comment wrapper class
584
- $comment_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_comment_class', 'comments-link' );
 
585
 
586
  ob_start();
587
- ?>
588
- <span class="<?php echo esc_attr( $comment_class ); ?>"><?php comments_popup_link( __( 'Leave a comment', PT_CV_DOMAIN ), __( '1 Comment', PT_CV_DOMAIN ), __( '% Comments', PT_CV_DOMAIN ) ); ?></span>
589
- <?php
590
- $html['comment'] = ob_get_clean();
591
  endif;
592
  break;
593
 
594
  case 'author':
595
 
596
  // Get author wrapper class
597
- $author_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_author_class', 'author' );
 
598
 
599
- $author_html = sprintf( '<span class="%s">%s <a href="%s" rel="author">%s</a></span>', esc_attr( $author_class ), __( 'by', PT_CV_DOMAIN ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() );
600
  $html['author'] = apply_filters( PT_CV_PREFIX_ . 'field_meta_author_html', $author_html, $post );
601
  break;
602
 
@@ -696,31 +706,30 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
696
 
697
  // With each type of asset (css, js), looking for suit file of selected style
698
  foreach ( $assets as $type ) {
699
- $file_path = $view_type_dir . '/' . $type . '/' . $style . '.' . $type;
700
- $assets_output[$type][] = PT_CV_Functions::file_include_content( $file_path );
 
 
 
701
  }
702
  }
703
 
704
- // Merge content of asset files
705
  if ( $assets_output ) {
706
- foreach ( $assets as $type ) {
707
 
708
- $asset_file = $type . '/' . 'assets' . '.' . $type;
 
709
 
710
- // Write to file
711
- $file_path = PT_CV_PUBLIC_ASSETS . $asset_file;
712
-
713
- if ( file_exists( $file_path ) ) {
714
- $fp = @fopen( $file_path, 'w' );
715
- fwrite( $fp, implode( "\n", $assets_output[$type] ) );
716
- fclose( $fp );
717
  }
718
-
719
- $assets_files[$type][] = PT_CV_PUBLIC_ASSETS_URI . $asset_file;
720
  }
721
  }
722
 
723
- $assets_files = apply_filters( PT_CV_PREFIX_ . 'assets_files', $assets_files );
 
724
 
725
  if ( is_admin() ) {
726
  // Include assets file in Preview
@@ -831,17 +840,18 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
831
  *
832
  * @return string
833
  */
834
- static function inline_script( $js ) {
835
  // Generate random id for script tag
836
  $random_id = PT_CV_Functions::string_random();
837
 
838
  ob_start();
839
  ?>
840
  <script type="text/javascript" id="<?php echo esc_attr( PT_CV_PREFIX . 'inline-script-' . $random_id ); ?>">
841
- (function ($) {
842
- $(function () { <?php echo balanceTags( $js ); ?>
843
- });
844
- }(jQuery));
 
845
  </script>
846
  <?php
847
  return ob_get_clean();
235
  }
236
 
237
  // Get wrapper class of a item
238
+ $layout = $dargs['layout-format'];
239
+ $item_class = apply_filters( PT_CV_PREFIX_ . 'content_item_class', array( $class, PT_CV_PREFIX . 'content-item', PT_CV_PREFIX . $layout ) );
240
 
241
  $item_filter = apply_filters( PT_CV_PREFIX_ . 'content_item_filter_value', '', $post_id );
242
 
415
  $content = '';
416
  switch ( $fargs['content']['show'] ) {
417
  case 'excerpt':
418
+ $length = (int) $fargs['content']['length'];
419
+ $readmore = '<br />' . PT_CV_Html::link_button( get_permalink(), 'success', __( 'Read More', PT_CV_DOMAIN ), PT_CV_PREFIX . 'readmore', 'btn-sm' );
420
+ $readmore_btn = ' ...' . apply_filters( PT_CV_PREFIX_ . 'field_content_readmore', $readmore, $fargs['content'], get_permalink() );
421
+ $content = apply_filters( PT_CV_PREFIX_ . 'field_content_result', '', $fargs, $post );
422
+
423
+ if ( empty( $content ) ) {
424
+ $content = wp_trim_words( strip_shortcodes( get_the_content() ), $length, $readmore_btn );
425
+ }
426
+
427
  break;
428
 
429
  case 'full':
569
  switch ( $meta ) {
570
  case 'date':
571
  // Get date wrapper class
572
+ $date_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_class', 'entry-date', 'date' );
573
+ $prefix_text = apply_filters( PT_CV_PREFIX_ . 'field_meta_prefix_text', '', 'date' );
574
 
575
+ $html['date'] = sprintf( '<span class="%s">%s <time datetime="%s">%s</time></span>', esc_html( $date_class ), balanceTags( $prefix_text ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) );
576
  break;
577
 
578
  case 'taxonomy':
579
 
580
  // Get terms wrapper class
581
+ $term_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_class', 'terms', 'terms' );
582
+ $prefix_text = apply_filters( PT_CV_PREFIX_ . 'field_meta_prefix_text', __( 'in', PT_CV_DOMAIN ), 'terms' );
583
 
584
  $terms = PT_CV_Functions::post_terms( $post );
585
  if ( ! empty( $terms ) ) {
586
+ $html['taxonomy'] = sprintf( '<span class="%s">%s %s</span>', esc_attr( $term_class ), balanceTags( $prefix_text ), balanceTags( $terms ) );
587
  }
588
  break;
589
 
590
  case 'comment':
591
  if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
592
  // Get comment wrapper class
593
+ $comment_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_class', 'comments-link', 'comment' );
594
+ $prefix_text = apply_filters( PT_CV_PREFIX_ . 'field_meta_prefix_text', '', 'comment' );
595
 
596
  ob_start();
597
+ comments_popup_link( __( 'Leave a comment', PT_CV_DOMAIN ), __( '1 Comment', PT_CV_DOMAIN ), __( '% Comments', PT_CV_DOMAIN ) );
598
+ $comment_content = ob_get_clean();
599
+ $html['comment'] = sprintf( '<span class="%s">%s %s</span>', esc_attr( $comment_class ), balanceTags( $prefix_text ), $comment_content );
 
600
  endif;
601
  break;
602
 
603
  case 'author':
604
 
605
  // Get author wrapper class
606
+ $author_class = apply_filters( PT_CV_PREFIX_ . 'field_meta_class', 'author', 'author' );
607
+ $prefix_text = apply_filters( PT_CV_PREFIX_ . 'field_meta_prefix_text', __( 'by', PT_CV_DOMAIN ), 'author' );
608
 
609
+ $author_html = sprintf( '<span class="%s">%s <a href="%s" rel="author">%s</a></span>', esc_attr( $author_class ), balanceTags( $prefix_text ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() );
610
  $html['author'] = apply_filters( PT_CV_PREFIX_ . 'field_meta_author_html', $author_html, $post );
611
  break;
612
 
706
 
707
  // With each type of asset (css, js), looking for suit file of selected style
708
  foreach ( $assets as $type ) {
709
+ $file_path = $view_type_dir . '/' . $type . '/' . $style . '.' . $type;
710
+ $content = PT_CV_Functions::file_include_content( $file_path );
711
+ if ( $content ) {
712
+ $assets_output[$type][] = $content;
713
+ }
714
  }
715
  }
716
 
717
+ // Echo script, style inline
718
  if ( $assets_output ) {
 
719
 
720
+ foreach ( $assets_output as $type => $contents ) {
721
+ $content = implode( "\n", $contents );
722
 
723
+ if ( $type == 'js' ) {
724
+ echo self::inline_script( $content, false );
725
+ } else {
726
+ echo self::inline_style( $content );
 
 
 
727
  }
 
 
728
  }
729
  }
730
 
731
+ // Link to external files
732
+ $assets_files = apply_filters( PT_CV_PREFIX_ . 'assets_files', array() );
733
 
734
  if ( is_admin() ) {
735
  // Include assets file in Preview
840
  *
841
  * @return string
842
  */
843
+ static function inline_script( $js, $wrap = true ) {
844
  // Generate random id for script tag
845
  $random_id = PT_CV_Functions::string_random();
846
 
847
  ob_start();
848
  ?>
849
  <script type="text/javascript" id="<?php echo esc_attr( PT_CV_PREFIX . 'inline-script-' . $random_id ); ?>">
850
+ <?php
851
+ $format = $wrap ? "(function ($) {\n $(function () { %s }); \n}(jQuery));" : '%s';
852
+ $content = balanceTags( $js );
853
+ printf( $format, $content );
854
+ ?>
855
  </script>
856
  <?php
857
  return ob_get_clean();
includes/settings.php CHANGED
@@ -179,6 +179,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
179
  'name' => $prefix . 'items-per-page',
180
  'std' => '5',
181
  'placeholder' => 'e.g. 5',
 
182
  'desc' => __( 'The number of items per page.[--br--]If value of Limit option is not blank (empty), this value should be smaller than Limit value', PT_CV_DOMAIN ),
183
  ),
184
  ),
@@ -358,7 +359,8 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
358
  'name' => $prefix . 'excerpt-length',
359
  'std' => '20',
360
  'placeholder' => 'e.g. 20',
361
- 'desc' => __( 'The number of words in excerpt', PT_CV_DOMAIN ),
 
362
  ),
363
  ),
364
  ),
@@ -519,7 +521,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
519
  array(
520
  'type' => 'checkbox',
521
  'name' => $prefix . 'meta-fields',
522
- 'options' => PT_CV_Values::yes_no( 'yes', __( 'Show Meta Fields', PT_CV_DOMAIN ) ),
523
  'std' => 'yes',
524
  ),
525
  ),
@@ -683,6 +685,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
683
  'type' => 'number',
684
  'name' => $prefix . 'number-columns',
685
  'std' => '2',
 
686
  'desc' => __( 'The number of items on each row of grid', PT_CV_DOMAIN ),
687
  ),
688
  ),
179
  'name' => $prefix . 'items-per-page',
180
  'std' => '5',
181
  'placeholder' => 'e.g. 5',
182
+ 'append_text' => '1 &rarr; 100',
183
  'desc' => __( 'The number of items per page.[--br--]If value of Limit option is not blank (empty), this value should be smaller than Limit value', PT_CV_DOMAIN ),
184
  ),
185
  ),
359
  'name' => $prefix . 'excerpt-length',
360
  'std' => '20',
361
  'placeholder' => 'e.g. 20',
362
+ 'append_text' => '1 &rarr; 100',
363
+ 'desc' => __( 'Generating excerpt by selecting the first X words of the content', PT_CV_DOMAIN ),
364
  ),
365
  ),
366
  ),
521
  array(
522
  'type' => 'checkbox',
523
  'name' => $prefix . 'meta-fields',
524
+ 'options' => PT_CV_Values::yes_no( 'yes', __( 'Show Meta Fields: Author, Date, Comment...', PT_CV_DOMAIN ) ),
525
  'std' => 'yes',
526
  ),
527
  ),
685
  'type' => 'number',
686
  'name' => $prefix . 'number-columns',
687
  'std' => '2',
688
+ 'append_text' => '1 &rarr; 10',
689
  'desc' => __( 'The number of items on each row of grid', PT_CV_DOMAIN ),
690
  ),
691
  ),
includes/values.php CHANGED
@@ -41,6 +41,27 @@ if ( ! class_exists( 'PT_CV_Values' ) ) {
41
 
42
  return $result;
43
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  /**
46
  * Get list of taxonomies
@@ -213,11 +234,11 @@ if ( ! class_exists( 'PT_CV_Values' ) ) {
213
  */
214
  static function advanced_settings() {
215
  return array(
216
- 'author' => __( 'Author', PT_CV_DOMAIN ),
217
- 'status' => __( 'Status', PT_CV_DOMAIN ),
218
  'taxonomy' => __( 'Taxonomy (Categories, Tags...)', PT_CV_DOMAIN ),
219
- 'search' => __( 'Search', PT_CV_DOMAIN ),
220
  'order' => __( 'Order & Orderby', PT_CV_DOMAIN ),
 
 
221
  );
222
  }
223
 
41
 
42
  return $result;
43
  }
44
+
45
+ /**
46
+ * Get list of post types and related taxonomies
47
+ *
48
+ * @return array
49
+ */
50
+ static function post_types_vs_taxonomies() {
51
+ // Get post types
52
+ $args = apply_filters( PT_CV_PREFIX_ . 'post_types', array( 'public' => true, 'show_ui' => true, '_builtin' => true ) );
53
+ $post_types = get_post_types( $args );
54
+
55
+ // Get taxonomies of post types
56
+ $result = array();
57
+
58
+ foreach ( $post_types as $post_type ) {
59
+ $taxonomy_names = get_object_taxonomies( $post_type );
60
+ $result[$post_type] = $taxonomy_names;
61
+ }
62
+
63
+ return $result;
64
+ }
65
 
66
  /**
67
  * Get list of taxonomies
234
  */
235
  static function advanced_settings() {
236
  return array(
 
 
237
  'taxonomy' => __( 'Taxonomy (Categories, Tags...)', PT_CV_DOMAIN ),
238
+ 'status' => __( 'Status', PT_CV_DOMAIN ),
239
  'order' => __( 'Order & Orderby', PT_CV_DOMAIN ),
240
+ 'search' => __( 'Search', PT_CV_DOMAIN ),
241
+ 'author' => __( 'Author', PT_CV_DOMAIN ),
242
  );
243
  }
244
 
public/assets/css/public.css CHANGED
@@ -13,17 +13,17 @@
13
 
14
  /* Link */
15
  .pt-cv-view a {
16
- color: #000;
17
  text-decoration: none !important;
18
  }
19
 
20
  .pt-cv-view a:hover, .pt-cv-view .panel-heading:hover a {
21
- color: #ff3c1f;
22
  }
23
 
24
  /* Read more */
25
  .pt-cv-readmore {
26
- color: #fff !important;
27
  margin: 10px 0;
28
  }
29
 
@@ -82,10 +82,6 @@
82
  padding-bottom: 15px;
83
  }
84
 
85
- .pt-cv-meta-fields * {
86
- color: rgba(0, 0, 0, .5);
87
- }
88
-
89
  .pt-cv-meta-fields a {
90
  color: #41b7d8;
91
  }
@@ -175,6 +171,10 @@
175
  color: #000;
176
  }
177
 
 
 
 
 
178
  /* Control */
179
  .pt-cv-view .carousel-control {
180
  background-image: none !important;
@@ -199,4 +199,9 @@
199
  .pt-cv-view .carousel-indicators li.active {
200
  background: #428bca;
201
  border: 1px solid #428bca;
 
 
 
 
 
202
  }
13
 
14
  /* Link */
15
  .pt-cv-view a {
16
+ /*color: #000;*/
17
  text-decoration: none !important;
18
  }
19
 
20
  .pt-cv-view a:hover, .pt-cv-view .panel-heading:hover a {
21
+ /*color: #ff3c1f;*/
22
  }
23
 
24
  /* Read more */
25
  .pt-cv-readmore {
26
+ color: #fff;
27
  margin: 10px 0;
28
  }
29
 
82
  padding-bottom: 15px;
83
  }
84
 
 
 
 
 
85
  .pt-cv-meta-fields a {
86
  color: #41b7d8;
87
  }
171
  color: #000;
172
  }
173
 
174
+ .pt-cv-cap-wo-img .pt-cv-readmore {
175
+ color: #fff;
176
+ }
177
+
178
  /* Control */
179
  .pt-cv-view .carousel-control {
180
  background-image: none !important;
199
  .pt-cv-view .carousel-indicators li.active {
200
  background: #428bca;
201
  border: 1px solid #428bca;
202
+ }
203
+
204
+ /* Layout */
205
+ .pt-cv-2-col .pt-cv-title {
206
+ clear: none !important;
207
  }
public/assets/js/public.js CHANGED
@@ -113,6 +113,7 @@
113
  action : 'pagination_request',
114
  sid : session_id,
115
  page : selected_page,
 
116
  ajax_nonce: PT_CV_PUBLIC._nonce
117
  };
118
 
113
  action : 'pagination_request',
114
  sid : session_id,
115
  page : selected_page,
116
+ is_admin : PT_CV_PUBLIC.is_admin,
117
  ajax_nonce: PT_CV_PUBLIC._nonce
118
  };
119