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

Version Description

  • Fix bug: javascript error of missing function
  • Update description for some options
  • Update styles
Download this release

Release Info

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

Code changes from version 1.2.5 to 1.2.6

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: post, posts, page, pages, query, queries, search, display, show, 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.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -148,6 +148,11 @@ You can create Unlimited Views, in Unlimited websites
148
 
149
  == Changelog ==
150
 
 
 
 
 
 
151
  = 1.2.5 =
152
  * Fix bug: doesn't save Layout format value when select '2 columns' option
153
  * Fix notice about constant value
@@ -219,6 +224,9 @@ You can create Unlimited Views, in Unlimited websites
219
 
220
  == Upgrade Notice ==
221
 
 
 
 
222
  = 1.2.5 =
223
  Fix bug: doesn't save Layout format value when select '2 columns' option. Fix constant notice
224
 
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
 
148
 
149
  == Changelog ==
150
 
151
+ = 1.2.6 =
152
+ * Fix bug: javascript error of missing function
153
+ * Update description for some options
154
+ * Update styles
155
+
156
  = 1.2.5 =
157
  * Fix bug: doesn't save Layout format value when select '2 columns' option
158
  * Fix notice about constant value
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
+
230
  = 1.2.5 =
231
  Fix bug: doesn't save Layout format value when select '2 columns' option. Fix constant notice
232
 
admin/assets/js/admin.js CHANGED
@@ -320,7 +320,7 @@
320
 
321
  // Create function to handle
322
  var fn_content_type = function (this_val, is_change) {
323
- if ( typeof this_val === 'undefined' ) {
324
  return;
325
  }
326
 
@@ -437,7 +437,7 @@
437
  $this_btn.html(PT_CV_ADMIN.btn.preview.show);
438
 
439
  // Enable preview
440
- setTimeout(function(){
441
  $self.options.can_preview = 1;
442
  }, $self.options.scroll_time);
443
  }
@@ -563,12 +563,12 @@
563
  * Toggle text of Preview button
564
  * @returns {undefined}
565
  */
566
- _preview_btn_toggle : function(){
567
 
568
  var $self = this;
569
  var _prefix = $self.options._prefix;
570
 
571
- var _fn = function(){
572
  $self.options.onload = 0;
573
 
574
  // Toggle text of this button
@@ -587,11 +587,38 @@
587
  });
588
  },
589
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590
  /**
591
  * Custom js for elements
592
  * @returns {undefined}
593
  */
594
- custom : function () {
595
 
596
  var $self = this;
597
  var _prefix = $self.options._prefix;
320
 
321
  // Create function to handle
322
  var fn_content_type = function (this_val, is_change) {
323
+ if (typeof this_val === 'undefined') {
324
  return;
325
  }
326
 
437
  $this_btn.html(PT_CV_ADMIN.btn.preview.show);
438
 
439
  // Enable preview
440
+ setTimeout(function () {
441
  $self.options.can_preview = 1;
442
  }, $self.options.scroll_time);
443
  }
563
  * Toggle text of Preview button
564
  * @returns {undefined}
565
  */
566
+ _preview_btn_toggle : function () {
567
 
568
  var $self = this;
569
  var _prefix = $self.options._prefix;
570
 
571
+ var _fn = function () {
572
  $self.options.onload = 0;
573
 
574
  // Toggle text of this button
587
  });
588
  },
589
 
590
+ /**
591
+ * Do handy toggle for Excerpt settings
592
+ *
593
+ * @returns {undefined}
594
+ */
595
+ handy_toggle_excerpt_settings: function () {
596
+ var _prefix = this.options._prefix;
597
+
598
+ var _this_toggle = function (show_content) {
599
+ if (!show_content) {
600
+ $('#' + _prefix + 'group-excerpt-settings').addClass('hidden');
601
+ } else {
602
+ $('#' + _prefix + 'group-excerpt-settings').removeClass('hidden');
603
+ }
604
+ };
605
+
606
+ var selector = '[name="' + _prefix + 'show-field-content' + '"]';
607
+
608
+ // Run on page load
609
+ _this_toggle($(selector).is(':checked'));
610
+
611
+ // Run on change
612
+ $(selector).change(function () {
613
+ _this_toggle($(selector).is(':checked'));
614
+ });
615
+ },
616
+
617
  /**
618
  * Custom js for elements
619
  * @returns {undefined}
620
  */
621
+ custom: function () {
622
 
623
  var $self = this;
624
  var _prefix = $self.options._prefix;
admin/includes/options.php CHANGED
@@ -254,7 +254,7 @@ if ( ! class_exists( 'PT_Options_Framework' ) ) {
254
  }
255
 
256
  $checked = ( in_array( $key, (array) $value ) || ( $value == 'all' ) ) ? 'checked' : '';
257
- $html .= "<div class='$type'><label><input type='$type' name='$name' value='$key' class='$class' $checked $id $extend>$text</label></div>";
258
  }
259
 
260
  break;
@@ -267,7 +267,7 @@ if ( ! class_exists( 'PT_Options_Framework' ) ) {
267
  foreach ( $param['options'] as $key => $text ) {
268
  $selected = ( in_array( $key, (array) $value ) || ( $value == 'all' ) ) ? 'selected' : '';
269
  $option_class = isset( $param['option_class_prefix'] ) ? sprintf( "class='%s'", $param['option_class_prefix'] . esc_attr( sanitize_title( $key ) ) ) : '';
270
- $options .= "<option value='$key' $selected $option_class>$text</option>";
271
  }
272
  if ( empty( $options ) ) {
273
  $html .= "<div class='" . PT_CV_PREFIX . "text'>" . __( 'There is no option', PT_CV_DOMAIN ) . '</div>';
@@ -283,7 +283,7 @@ if ( ! class_exists( 'PT_Options_Framework' ) ) {
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>";
@@ -306,8 +306,10 @@ if ( ! class_exists( 'PT_Options_Framework' ) ) {
306
  break;
307
  }
308
 
 
 
 
309
  if ( ! empty( $description ) ) {
310
- $description = str_replace( '[--br--]', '<br>', $description );
311
  $html .= "<p class='text-muted'>$description</p>";
312
  }
313
 
@@ -330,7 +332,7 @@ if ( ! class_exists( 'PT_Options_Framework' ) ) {
330
  // Content for body
331
  $content = self::do_settings( $param_group, $data );
332
  // Class for wrapper
333
- $class = PT_CV_Html::html_group_class();
334
  $class .= ( isset( $settings['show_all'] ) ? '' : ' hidden' );
335
  $class .= ( isset( $settings['show_only_one'] ) ? ' ' . PT_CV_PREFIX . 'only-one' : '' );
336
  $class .= ( isset( $settings['no_panel'] ) ? ' ' . PT_CV_PREFIX . 'no-panel' : '' );
254
  }
255
 
256
  $checked = ( in_array( $key, (array) $value ) || ( $value == 'all' ) ) ? 'checked' : '';
257
+ $html .= "<div class='$type'><label><input type='$type' name='$name' value='$key' class='$class' $checked $id $extend>$text</label></div>";
258
  }
259
 
260
  break;
267
  foreach ( $param['options'] as $key => $text ) {
268
  $selected = ( in_array( $key, (array) $value ) || ( $value == 'all' ) ) ? 'selected' : '';
269
  $option_class = isset( $param['option_class_prefix'] ) ? sprintf( "class='%s'", $param['option_class_prefix'] . esc_attr( sanitize_title( $key ) ) ) : '';
270
+ $options .= "<option value='$key' $selected $option_class>$text</option>";
271
  }
272
  if ( empty( $options ) ) {
273
  $html .= "<div class='" . PT_CV_PREFIX . "text'>" . __( 'There is no option', PT_CV_DOMAIN ) . '</div>';
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>";
306
  break;
307
  }
308
 
309
+ $description = str_replace( '[--br--]', '<br>', $description );
310
+ $description = apply_filters( PT_CV_PREFIX_ . 'options_description', $description, $param );
311
+
312
  if ( ! empty( $description ) ) {
 
313
  $html .= "<p class='text-muted'>$description</p>";
314
  }
315
 
332
  // Content for body
333
  $content = self::do_settings( $param_group, $data );
334
  // Class for wrapper
335
+ $class = PT_CV_Html::html_group_class();
336
  $class .= ( isset( $settings['show_all'] ) ? '' : ' hidden' );
337
  $class .= ( isset( $settings['show_only_one'] ) ? ' ' . PT_CV_PREFIX . 'only-one' : '' );
338
  $class .= ( isset( $settings['no_panel'] ) ? ' ' . PT_CV_PREFIX . 'no-panel' : '' );
admin/includes/plugin.php CHANGED
@@ -66,14 +66,14 @@ if ( ! class_exists( 'PT_CV_Plugin' ) ) {
66
 
67
  self::$options = get_option( PT_CV_OPTION_NAME );
68
  ?>
69
- <form method="post" action="options.php">
70
- <?php
71
- // This prints out all hidden setting fields
72
- settings_fields( PT_CV_OPTION_NAME . '_group' );
73
- do_settings_sections( PT_CV_DOMAIN );
74
- submit_button();
75
- ?>
76
- </form>
77
  <?php
78
  $text = ob_get_clean();
79
 
@@ -92,25 +92,32 @@ if ( ! class_exists( 'PT_CV_Plugin' ) ) {
92
  );
93
 
94
  // Common setting Section
95
- $this_section = 'setting_unload_bootstrap';
96
  add_settings_section(
97
  $this_section, // ID
98
  __( '', PT_CV_DOMAIN ), // Title
99
- array( __CLASS__, 'section_callback_setting_unload_bootstrap' ), // Callback
100
  PT_CV_DOMAIN // Page
101
  );
102
 
103
  // Define Common setting fields
104
- $account_fields = array(
105
  array(
106
  'id' => 'unload_bootstrap',
107
  'title' => '<strong>' . __( 'Frontend assets', PT_CV_DOMAIN ) . '</strong>',
108
  ),
109
  );
110
 
 
 
 
 
 
 
111
  // Register Common setting fields
112
- foreach ( $account_fields as $field ) {
113
- self::field_register( $field, $this_section );
 
114
  }
115
 
116
  do_action( PT_CV_PREFIX_ . 'settings_page' );
@@ -136,7 +143,7 @@ if ( ! class_exists( 'PT_CV_Plugin' ) ) {
136
  *
137
  * @param array $field_info Field information
138
  * @param string $section Id of setting section
139
- * @param string $class Class name to find the callback function
140
  */
141
  public static function field_register( $field_info, $section, $class = __CLASS__ ) {
142
  if ( ! $field_info ) {
@@ -158,7 +165,7 @@ if ( ! class_exists( 'PT_CV_Plugin' ) ) {
158
  public static function field_callback_unload_bootstrap() {
159
  $field_name = 'unload_bootstrap';
160
 
161
- self::_field_print( $field_name, 'checkbox', __( "Don't load Bootstrap style & script in frontend of website", PT_CV_DOMAIN ) );
162
  }
163
 
164
  /**
@@ -166,13 +173,13 @@ if ( ! class_exists( 'PT_CV_Plugin' ) ) {
166
  *
167
  * @param string $field_name The ID of field
168
  * @param string $field_type The type of field
169
- * @param string $desc Description text
170
  */
171
  static function _field_print( $field_name, $field_type = 'text', $desc = '' ) {
172
 
173
  // Get Saved value
174
  $field_value = isset( self::$options[$field_name] ) ? esc_attr( self::$options[$field_name] ) : '';
175
- $checked = '';
176
 
177
  if ( in_array( $field_type, array( 'checkbox', 'radio' ) ) ) {
178
  $checked = checked( 1, $field_value, false );
@@ -187,7 +194,7 @@ if ( ! class_exists( 'PT_CV_Plugin' ) ) {
187
  esc_attr( $field_type ), $field_id, PT_CV_OPTION_NAME, $field_value, $checked
188
  );
189
 
190
- if ( !empty( $desc)){
191
  printf( '<label for="%s" class="label-for-option">%s</label>', $field_id, $desc );
192
  }
193
  }
@@ -195,7 +202,7 @@ if ( ! class_exists( 'PT_CV_Plugin' ) ) {
195
  /**
196
  * Print the text for Common setting Section
197
  */
198
- public static function section_callback_setting_unload_bootstrap() {
199
 
200
  }
201
  }
66
 
67
  self::$options = get_option( PT_CV_OPTION_NAME );
68
  ?>
69
+ <form method="post" action="options.php">
70
+ <?php
71
+ // This prints out all hidden setting fields
72
+ settings_fields( PT_CV_OPTION_NAME . '_group' );
73
+ do_settings_sections( PT_CV_DOMAIN );
74
+ submit_button();
75
+ ?>
76
+ </form>
77
  <?php
78
  $text = ob_get_clean();
79
 
92
  );
93
 
94
  // Common setting Section
95
+ $this_section = 'setting_frontend_assets';
96
  add_settings_section(
97
  $this_section, // ID
98
  __( '', PT_CV_DOMAIN ), // Title
99
+ array( __CLASS__, 'section_callback_setting_frontend_assets' ), // Callback
100
  PT_CV_DOMAIN // Page
101
  );
102
 
103
  // Define Common setting fields
104
+ $frontend_assets_fields = array(
105
  array(
106
  'id' => 'unload_bootstrap',
107
  'title' => '<strong>' . __( 'Frontend assets', PT_CV_DOMAIN ) . '</strong>',
108
  ),
109
  );
110
 
111
+ // Filter Frontend assets option
112
+ $frontend_assets_fields = apply_filters( PT_CV_PREFIX_ . 'frontend_assets_fields', $frontend_assets_fields );
113
+
114
+ // Add classes to find callback function for extra options
115
+ $defined_in_class = (array) apply_filters( PT_CV_PREFIX_ . 'defined_in_class', array() );
116
+
117
  // Register Common setting fields
118
+ foreach ( $frontend_assets_fields as $field ) {
119
+ $class = ( array_key_exists( $field['id'], $defined_in_class ) ) ? $defined_in_class[$field['id']] : __CLASS__;
120
+ self::field_register( $field, $this_section, $class );
121
  }
122
 
123
  do_action( PT_CV_PREFIX_ . 'settings_page' );
143
  *
144
  * @param array $field_info Field information
145
  * @param string $section Id of setting section
146
+ * @param string $class Class name to find the callback function
147
  */
148
  public static function field_register( $field_info, $section, $class = __CLASS__ ) {
149
  if ( ! $field_info ) {
165
  public static function field_callback_unload_bootstrap() {
166
  $field_name = 'unload_bootstrap';
167
 
168
+ self::_field_print( $field_name, 'checkbox', __( "Don't load <b>Bootstrap</b> style & script (in frontend of website)", PT_CV_DOMAIN ) );
169
  }
170
 
171
  /**
173
  *
174
  * @param string $field_name The ID of field
175
  * @param string $field_type The type of field
176
+ * @param string $desc Description text
177
  */
178
  static function _field_print( $field_name, $field_type = 'text', $desc = '' ) {
179
 
180
  // Get Saved value
181
  $field_value = isset( self::$options[$field_name] ) ? esc_attr( self::$options[$field_name] ) : '';
182
+ $checked = '';
183
 
184
  if ( in_array( $field_type, array( 'checkbox', 'radio' ) ) ) {
185
  $checked = checked( 1, $field_value, false );
194
  esc_attr( $field_type ), $field_id, PT_CV_OPTION_NAME, $field_value, $checked
195
  );
196
 
197
+ if ( ! empty( $desc ) ) {
198
  printf( '<label for="%s" class="label-for-option">%s</label>', $field_id, $desc );
199
  }
200
  }
202
  /**
203
  * Print the text for Common setting Section
204
  */
205
+ public static function section_callback_setting_frontend_assets() {
206
 
207
  }
208
  }
admin/includes/templates/settings-section-one.php CHANGED
@@ -1,2 +1,3 @@
1
  <p><br>Thank you for using Content Views!</p>
2
- <p>You are using <strong>Free</strong> version: <?php echo PT_CV_Functions::plugin_info( PT_CV_FILE, 'Version' ); ?></p>
 
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>
admin/includes/templates/settings-section-two.php CHANGED
@@ -1,5 +1,7 @@
1
  <hr>
2
- <p>Here is list of some of awesome features which are available at <a href="http://www.contentviewspro.com/?utm_source=settings_page&utm_medium=link&utm_campaign=content-views" target="_blank">Content Views PRO</a></p>
 
 
3
 
4
  <p>
5
  <a href="http://www.contentviewspro.com/pricing/?utm_source=settings_page&utm_medium=link&utm_campaign=content-views" target="_blank" class="btn btn-success btn-sm">Upgrade now</a>
@@ -10,8 +12,10 @@
10
  <h3>
11
  Query custom post types
12
  </h3>
 
13
  <div>
14
  <p>You can get any posts of any custom post types (<strong>WooCommerce</strong> product, FAQ, Book...)</p>
 
15
  <p>Especially, with <strong>WooCommerce</strong>, there are quick filters to pick up</p>
16
  <ul style="list-style: circle; margin-left: 20px;">
17
  <li>Recent products</li>
@@ -24,7 +28,7 @@
24
  </div>
25
  <div class="col-md-6">
26
  <div>
27
- <img src="<?php echo plugins_url('admin/assets/images/features/woocommerce.png', PT_CV_FILE); ?>" />
28
  </div>
29
  </div>
30
  </div>
@@ -36,32 +40,37 @@
36
  <h3>
37
  More beautiful & awesome layouts
38
  </h3>
 
39
  <div>
40
  <div class="row">
41
  <div class="col-md-6">
42
  <h6>Scrollable list</h6>
 
43
  <div>
44
- <img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/scrollable.png', PT_CV_FILE); ?>" />
45
  </div>
46
  </div>
47
  <div class="col-md-6">
48
  <h6>Collapsible list</h6>
 
49
  <div>
50
- <img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/collapsible.png', PT_CV_FILE); ?>" />
51
  </div>
52
  </div>
53
  </div>
54
  <div class="row">
55
  <div class="col-md-6">
56
  <h6>Pinterest</h6>
 
57
  <div>
58
- <img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/pinterest.png', PT_CV_FILE); ?>" />
59
  </div>
60
  </div>
61
  <div class="col-md-6">
62
  <h6>Timeline</h6>
 
63
  <div>
64
- <img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/timeline.png', PT_CV_FILE); ?>" />
65
  </div>
66
  </div>
67
  </div>
@@ -76,16 +85,18 @@
76
  <h3>
77
  Drag & drop to change display order of fields
78
  </h3>
 
79
  <div>
80
- <img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/drag_drop.png', PT_CV_FILE); ?>" />
81
  </div>
82
  </div>
83
  <div class="col-md-6">
84
  <h3>
85
  Read more settings
86
  </h3>
 
87
  <div>
88
- <img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/readmore.png', PT_CV_FILE); ?>" />
89
  </div>
90
  </div>
91
  </div>
@@ -97,18 +108,20 @@
97
  <h3>
98
  Custom font settings
99
  </h3>
 
100
  <div>
101
  <p>You can customize Font family (from top 50 most popular Google fonts), font style, font size for Title, Content, Meta fields easily</p>
102
- <img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/font-settings.png', PT_CV_FILE); ?>" style="height: 210px;" />
103
  </div>
104
  </div>
105
  <div class="col-md-6">
106
  <h3>
107
  And more powerful options
108
  </h3>
 
109
  <div>
110
- <img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/pagination.png', PT_CV_FILE); ?>" />
111
- <img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/openin.png', PT_CV_FILE); ?>" />
112
  <br> <span style="font-size: 30px;">...</span>
113
  </div>
114
  </div>
1
  <hr>
2
+ <p>Here is list of some of awesome features which are available at
3
+ <a href="http://www.contentviewspro.com/?utm_source=settings_page&utm_medium=link&utm_campaign=content-views" target="_blank">Content Views PRO</a>
4
+ </p>
5
 
6
  <p>
7
  <a href="http://www.contentviewspro.com/pricing/?utm_source=settings_page&utm_medium=link&utm_campaign=content-views" target="_blank" class="btn btn-success btn-sm">Upgrade now</a>
12
  <h3>
13
  Query custom post types
14
  </h3>
15
+
16
  <div>
17
  <p>You can get any posts of any custom post types (<strong>WooCommerce</strong> product, FAQ, Book...)</p>
18
+
19
  <p>Especially, with <strong>WooCommerce</strong>, there are quick filters to pick up</p>
20
  <ul style="list-style: circle; margin-left: 20px;">
21
  <li>Recent products</li>
28
  </div>
29
  <div class="col-md-6">
30
  <div>
31
+ <img src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/woocommerce.png', PT_CV_FILE ) ); ?>" />
32
  </div>
33
  </div>
34
  </div>
40
  <h3>
41
  More beautiful & awesome layouts
42
  </h3>
43
+
44
  <div>
45
  <div class="row">
46
  <div class="col-md-6">
47
  <h6>Scrollable list</h6>
48
+
49
  <div>
50
+ <img class="thumbnail" src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/scrollable.png', PT_CV_FILE ) ); ?>" />
51
  </div>
52
  </div>
53
  <div class="col-md-6">
54
  <h6>Collapsible list</h6>
55
+
56
  <div>
57
+ <img class="thumbnail" src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/collapsible.png', PT_CV_FILE ) ); ?>" />
58
  </div>
59
  </div>
60
  </div>
61
  <div class="row">
62
  <div class="col-md-6">
63
  <h6>Pinterest</h6>
64
+
65
  <div>
66
+ <img class="thumbnail" src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/pinterest.png', PT_CV_FILE ) ); ?>" />
67
  </div>
68
  </div>
69
  <div class="col-md-6">
70
  <h6>Timeline</h6>
71
+
72
  <div>
73
+ <img class="thumbnail" src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/timeline.png', PT_CV_FILE ) ); ?>" />
74
  </div>
75
  </div>
76
  </div>
85
  <h3>
86
  Drag & drop to change display order of fields
87
  </h3>
88
+
89
  <div>
90
+ <img class="thumbnail" src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/drag_drop.png', PT_CV_FILE ) ); ?>" />
91
  </div>
92
  </div>
93
  <div class="col-md-6">
94
  <h3>
95
  Read more settings
96
  </h3>
97
+
98
  <div>
99
+ <img class="thumbnail" src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/readmore.png', PT_CV_FILE ) ); ?>" />
100
  </div>
101
  </div>
102
  </div>
108
  <h3>
109
  Custom font settings
110
  </h3>
111
+
112
  <div>
113
  <p>You can customize Font family (from top 50 most popular Google fonts), font style, font size for Title, Content, Meta fields easily</p>
114
+ <img class="thumbnail" src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/font-settings.png', PT_CV_FILE ) ); ?>" style="height: 210px;" />
115
  </div>
116
  </div>
117
  <div class="col-md-6">
118
  <h3>
119
  And more powerful options
120
  </h3>
121
+
122
  <div>
123
+ <img class="thumbnail" src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/pagination.png', PT_CV_FILE ) ); ?>" />
124
+ <img class="thumbnail" src="<?php echo esc_url( plugins_url( 'admin/assets/images/features/openin.png', PT_CV_FILE ) ); ?>" />
125
  <br> <span style="font-size: 30px;">...</span>
126
  </div>
127
  </div>
admin/views/admin.php CHANGED
@@ -15,13 +15,39 @@
15
  <h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
16
 
17
  <style>
18
- .wrap * { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; }
19
- .wrap > .row { padding-bottom: 20px; }
20
- .wrap p, .wrap form { font-size: 14px; }
21
- .wrap h3 { font-size: 16px; font-weight: bold; color: #FF6A5A; }
22
- .wrap h6 { font-size: 15px; font-weight: bold; }
23
- .wrap img { max-width: 100%; }
24
- .wrap .label-for-option { font-weight: normal; margin: auto; margin-bottom: -5px; margin-left: 4px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  </style>
26
 
27
  <?php
15
  <h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
16
 
17
  <style>
18
+ .wrap * {
19
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
20
+ }
21
+
22
+ .wrap > .row {
23
+ padding-bottom: 20px;
24
+ }
25
+
26
+ .wrap p, .wrap form {
27
+ font-size: 14px;
28
+ }
29
+
30
+ .wrap h3 {
31
+ font-size: 16px;
32
+ font-weight: bold;
33
+ color: #FF6A5A;
34
+ }
35
+
36
+ .wrap h6 {
37
+ font-size: 15px;
38
+ font-weight: bold;
39
+ }
40
+
41
+ .wrap img {
42
+ max-width: 100%;
43
+ }
44
+
45
+ .wrap .label-for-option {
46
+ font-weight: normal;
47
+ margin: auto;
48
+ margin-bottom: -5px;
49
+ margin-left: 4px;
50
+ }
51
  </style>
52
 
53
  <?php
admin/views/view.php CHANGED
@@ -193,10 +193,10 @@ $options = array(
193
 
194
  // Parent page
195
  array(
196
- 'label' => array(
197
  'text' => __( 'Parent page', PT_CV_DOMAIN ),
198
  ),
199
- 'params' => array(
200
  array(
201
  'type' => 'number',
202
  'name' => 'post_parent',
@@ -204,7 +204,7 @@ $options = array(
204
  'desc' => __( 'Enter ID of parent page to query child pages', PT_CV_DOMAIN ),
205
  ),
206
  ),
207
- 'dependence' => array( 'content-type', 'page' ),
208
  ),
209
 
210
  // Limit
@@ -489,7 +489,7 @@ echo balanceTags( PT_Options_Framework::do_settings( $options, $settings ) );
489
  // Layout format of output item
490
  array(
491
  'label' => array(
492
- 'text' => __( 'Layout format of an output item', PT_CV_DOMAIN ),
493
  ),
494
  'params' => array(
495
  array(
@@ -497,6 +497,7 @@ echo balanceTags( PT_Options_Framework::do_settings( $options, $settings ) );
497
  'name' => 'layout-format',
498
  'options' => PT_CV_Values::layout_format(),
499
  'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::layout_format() ),
 
500
  ),
501
  ),
502
  ),
193
 
194
  // Parent page
195
  array(
196
+ 'label' => array(
197
  'text' => __( 'Parent page', PT_CV_DOMAIN ),
198
  ),
199
+ 'params' => array(
200
  array(
201
  'type' => 'number',
202
  'name' => 'post_parent',
204
  'desc' => __( 'Enter ID of parent page to query child pages', PT_CV_DOMAIN ),
205
  ),
206
  ),
207
+ 'dependence' => array( 'content-type', 'page' ),
208
  ),
209
 
210
  // Limit
489
  // Layout format of output item
490
  array(
491
  'label' => array(
492
+ 'text' => __( 'Layout format', PT_CV_DOMAIN ),
493
  ),
494
  'params' => array(
495
  array(
497
  'name' => 'layout-format',
498
  'options' => PT_CV_Values::layout_format(),
499
  'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::layout_format() ),
500
+ 'desc' => __( 'This is layout format of output for each post', PT_CV_DOMAIN ),
501
  ),
502
  ),
503
  ),
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.5
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.5' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  include_once( plugin_dir_path( __FILE__ ) . 'includes/defines.php' );
33
 
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
  /*
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
 
includes/assets.php CHANGED
@@ -92,7 +92,7 @@ if ( ! class_exists( 'PT_CV_Asset' ) ) {
92
  'deps' => array( 'jquery' ),
93
  ),
94
  'bootstrap-paginator' => array(
95
- 'src' => plugins_url( 'assets/bootstrap-paginator/bootstrap-paginator.min.js', PT_CV_FILE ),
96
  // 'deps' => array( PT_CV_PREFIX . 'bootstrap' . '-' . 'script' ),
97
  ),
98
  'select2' => array(
92
  'deps' => array( 'jquery' ),
93
  ),
94
  'bootstrap-paginator' => array(
95
+ 'src' => plugins_url( 'assets/bootstrap-paginator/bootstrap-paginator.min.js', PT_CV_FILE ),
96
  // 'deps' => array( PT_CV_PREFIX . 'bootstrap' . '-' . 'script' ),
97
  ),
98
  'select2' => array(
includes/functions.php CHANGED
@@ -26,8 +26,10 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
26
  * Compare current Wordpress version with a version
27
  *
28
  * @global string $wp_version
29
- * @param string $version_to_compare
30
- * @param string $operator
 
 
31
  * @return boolean
32
  */
33
  static function wp_version_compare( $version_to_compare, $operator = '>=' ) {
@@ -36,6 +38,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
36
  }
37
 
38
  global $wp_version;
 
39
  // Check if using Wordpress version 3.7 or higher
40
  return version_compare( $wp_version, $version_to_compare, $operator );
41
  }
@@ -156,8 +159,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
156
  * Start SESSION
157
  */
158
  static function session_start() {
159
- if( ! session_id() )
160
- {
161
  session_start();
162
  }
163
  }
@@ -178,9 +180,9 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
178
  /**
179
  * Get value of a setting from global settings array
180
  *
181
- * @param string $field The full name of setting to get value
182
- * @param array $array_to_get Array to get values of wanted setting
183
- * @param mixed|null $assign The value to assign if setting is not found
184
  */
185
  static function setting_value( $field, $array_to_get, $assign = NULL ) {
186
  return isset( $array_to_get[$field] ) ? $array_to_get[$field] : $assign;
@@ -225,7 +227,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
225
  /**
226
  * Get value of some setting options by prefix
227
  *
228
- * @param string $prefix The prefix in name of setting options
229
  */
230
  static function settings_values_by_prefix( $prefix ) {
231
  global $pt_view_settings;
@@ -250,6 +252,8 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
250
  * @return string
251
  */
252
  static function post_terms( $post ) {
 
 
253
 
254
  // List of HTML link to terms
255
  $links = array();
@@ -259,8 +263,11 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
259
 
260
  $taxonomies = apply_filters( PT_CV_PREFIX_ . 'taxonomies_list', $taxonomies );
261
 
 
 
 
262
  // Get lists of terms of this post
263
- $terms = wp_get_object_terms( $post->ID, $taxonomies );
264
 
265
  foreach ( $terms as $term ) {
266
  $links[] = sprintf(
@@ -269,6 +276,11 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
269
  __( 'View all posts in', PT_CV_DOMAIN ),
270
  $term->name
271
  );
 
 
 
 
 
272
  }
273
 
274
  return implode( ', ', $links );
@@ -330,6 +342,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
330
  * Get View id in post table, from "id" meta key value
331
  *
332
  * @param string $meta_id ID of custom field
 
333
  * @return int Return Post ID of this view
334
  */
335
  static function post_id_from_meta_id( $meta_id ) {
@@ -400,6 +413,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
400
  // Get view settings
401
  if ( $post_id ) {
402
  $view_settings = get_post_meta( $post_id, PT_CV_META_SETTINGS, true );
 
403
  return is_array( $view_settings ) ? $view_settings : array();
404
  }
405
 
@@ -440,29 +454,31 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
440
  $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $pt_view_settings );
441
 
442
  // Store Display settings
443
- global $dargs;
444
 
445
  if ( $pargs && isset( $pargs['session_id'] ) ) {
446
- $unique_id = $pargs['session_id'];
447
  }
448
 
449
- if ( empty( $unique_id ) ) {
450
- $unique_id = PT_CV_Functions::string_random();
451
  }
452
 
453
- if ( $unique_id ) {
 
 
 
454
 
455
  $session_data = array_merge(
456
  array( '$args' => '', '$dargs' => '' ),
457
- isset( $_SESSION[PT_CV_PREFIX . 'view_' . $unique_id] ) ? (array) $_SESSION[PT_CV_PREFIX . 'view_' . $unique_id] : array()
458
  );
459
 
460
- $args = $session_data['$args'];
461
  $dargs = $session_data['$dargs'];
462
  }
463
 
464
- if ( empty( $args ) || empty( $dargs ) )
465
- {
466
  /**
467
  * Get Query parameters
468
  * Set default values
@@ -475,7 +491,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
475
 
476
  // Post in
477
  if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__in', $pt_view_settings ) ) {
478
- $post_in = PT_CV_Functions::string_to_array( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'post__in', $pt_view_settings ) );
479
  $args['post__in'] = array_map( 'intval', array_filter( $post_in ) );
480
  }
481
 
@@ -514,12 +530,12 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
514
 
515
  // Filter
516
  $dargs = apply_filters( PT_CV_PREFIX_ . 'all_display_settings', $dargs );
517
- $args = apply_filters( PT_CV_PREFIX_ . 'query_parameters', $args );
518
 
519
  // Save settings
520
- if ( ! empty( $unique_id ) ) {
521
- $_SESSION[PT_CV_PREFIX . 'view_' . $unique_id] = array(
522
- '$args' => $args,
523
  '$dargs' => $dargs,
524
  );
525
  }
@@ -536,6 +552,11 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
536
  return ( implode( '</p><p>', $error ) );
537
  }
538
 
 
 
 
 
 
539
  /**
540
  * Output Items
541
  */
@@ -557,7 +578,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
557
  global $post;
558
 
559
  // Output HTML for this item
560
- $content_items[] = PT_CV_Html::view_type_output( $view_type, $post );
561
  }
562
  } else {
563
  // Get no post found class
@@ -573,6 +594,9 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
573
  // Restore original Post Data
574
  wp_reset_postdata();
575
 
 
 
 
576
  /**
577
  * Output Pagination
578
  */
@@ -590,7 +614,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
590
  // Total number of pages
591
  $max_num_pages = ceil( $total_items / $args['posts_per_page'] );
592
 
593
- $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, is_admin() ? '' : $unique_id );
594
  }
595
 
596
  return $html;
@@ -764,7 +788,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
764
  /**
765
  * Get Fields settings
766
  *
767
- * @param array $dargs The settings array of Fields
768
  */
769
  static function view_get_display_settings( &$dargs ) {
770
  global $pt_view_settings;
@@ -786,7 +810,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
786
  * Fields settings
787
  */
788
  $cfields_settings = PT_CV_Functions::settings_values_by_prefix( PT_CV_PREFIX . 'show-field-' );
789
- $cfields = (array) array_keys( (array) $cfields_settings );
790
  foreach ( $cfields as $field ) {
791
  // If show this field
792
  if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'show-field-' . $field, $pt_view_settings ) ) {
@@ -814,9 +838,9 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
814
 
815
  $field_setting = array();
816
 
817
- $prefix = PT_CV_PREFIX . 'meta-fields-';
818
  $meta_fields_settings = PT_CV_Functions::settings_values_by_prefix( PT_CV_PREFIX . 'meta-fields-' );
819
- $fields = (array) array_keys( (array) $meta_fields_settings );
820
 
821
  PT_CV_Functions::settings_values( $fields, $field_setting, $pt_view_settings, $prefix );
822
 
@@ -851,18 +875,18 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
851
  /**
852
  * Get Pagination settings
853
  *
854
- * @param array $dargs The settings array of Fields
855
- * @param array $args The parameters array
856
- * @param array $pargs The pagination settings array
857
  */
858
  static function view_get_pagination_settings( &$dargs, &$args, $pargs ) {
859
  global $pt_view_settings;
860
 
861
  // Get Limit value
862
- $limit = trim( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'limit', $pt_view_settings ) );
863
- $limit = ( empty( $limit ) || $limit === '-1' ) ? 10000000 : (int) $limit;
864
  $args['limit'] = $args['posts_per_page'] = $limit;
865
- $offset = 0;
866
 
867
  // Get pagination enable/disable
868
  $pagination = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'enable-pagination', $pt_view_settings );
@@ -893,17 +917,14 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
893
 
894
  $offset = apply_filters( PT_CV_PREFIX_ . 'settings_args_offset', $offset );
895
 
896
- // Not reaching out of limit
897
- if ( $offset < $limit ) {
898
- // Set 'offset' parameter
899
- $args['offset'] = $offset;
900
- }
901
  }
902
 
903
  /**
904
  * Get Other settings
905
  *
906
- * @param array $dargs The settings array of Fields
907
  */
908
  static function view_get_other_settings( &$dargs ) {
909
  global $pt_view_settings;
@@ -955,7 +976,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
955
  update_post_meta( $post_id, PT_CV_META_SETTINGS, (array) $_POST );
956
 
957
  // Update post title
958
- if ( strpos( $title,'[ID:' ) === false ) {
959
  PT_CV_Functions::post_insert( array( 'ID' => $post_id, 'title' => sprintf( '%s [ID: %s]', $title, $view_id ) ) );
960
  }
961
 
@@ -1009,7 +1030,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
1009
  $edit_link = admin_url( 'admin.php?page=' . PT_CV_DOMAIN . '-add' );
1010
  if ( ! empty( $view_id ) ) {
1011
  $query_args = array( 'id' => $view_id );
1012
- $edit_link = add_query_arg( $query_args, $edit_link );
1013
  }
1014
 
1015
  return $edit_link;
@@ -1049,9 +1070,9 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
1049
  check_ajax_referer( PT_CV_PREFIX_ . 'ajax_nonce', 'ajax_nonce' );
1050
 
1051
  // Session id
1052
- $id = esc_sql( $_POST['id'] );
1053
 
1054
- $post_fix = empty( $id ) ? '' : '_frontend';
1055
 
1056
  // Get saved $settings
1057
  if ( isset( $_SESSION[PT_CV_PREFIX . 'settings' . $post_fix] ) ) {
@@ -1061,10 +1082,10 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
1061
  }
1062
 
1063
  // Pagination settings
1064
- $pargs = array( 'session_id' => $id , 'page' => (int) esc_sql( $_POST['page'] ) );
1065
 
1066
  // Show View output
1067
- echo balanceTags( PT_CV_Functions::view_process_settings( null, $settings, $pargs ) );
1068
 
1069
  // Must exit
1070
  die;
26
  * Compare current Wordpress version with a version
27
  *
28
  * @global string $wp_version
29
+ *
30
+ * @param string $version_to_compare
31
+ * @param string $operator
32
+ *
33
  * @return boolean
34
  */
35
  static function wp_version_compare( $version_to_compare, $operator = '>=' ) {
38
  }
39
 
40
  global $wp_version;
41
+
42
  // Check if using Wordpress version 3.7 or higher
43
  return version_compare( $wp_version, $version_to_compare, $operator );
44
  }
159
  * Start SESSION
160
  */
161
  static function session_start() {
162
+ if ( ! session_id() ) {
 
163
  session_start();
164
  }
165
  }
180
  /**
181
  * Get value of a setting from global settings array
182
  *
183
+ * @param string $field The full name of setting to get value
184
+ * @param array $array_to_get Array to get values of wanted setting
185
+ * @param mixed|null $assign The value to assign if setting is not found
186
  */
187
  static function setting_value( $field, $array_to_get, $assign = NULL ) {
188
  return isset( $array_to_get[$field] ) ? $array_to_get[$field] : $assign;
227
  /**
228
  * Get value of some setting options by prefix
229
  *
230
+ * @param string $prefix The prefix in name of setting options
231
  */
232
  static function settings_values_by_prefix( $prefix ) {
233
  global $pt_view_settings;
252
  * @return string
253
  */
254
  static function post_terms( $post ) {
255
+ global $pt_post_terms;
256
+
257
 
258
  // List of HTML link to terms
259
  $links = array();
263
 
264
  $taxonomies = apply_filters( PT_CV_PREFIX_ . 'taxonomies_list', $taxonomies );
265
 
266
+ // Get post ID
267
+ $post_id = is_object( $post ) ? $post->ID : $post;
268
+
269
  // Get lists of terms of this post
270
+ $terms = wp_get_object_terms( $post_id, $taxonomies );
271
 
272
  foreach ( $terms as $term ) {
273
  $links[] = sprintf(
276
  __( 'View all posts in', PT_CV_DOMAIN ),
277
  $term->name
278
  );
279
+
280
+ if ( ! isset( $pt_post_terms[$post_id] ) ) {
281
+ $pt_post_terms[$post_id] = array();
282
+ }
283
+ $pt_post_terms[$post_id][$term->slug] = $term->name;
284
  }
285
 
286
  return implode( ', ', $links );
342
  * Get View id in post table, from "id" meta key value
343
  *
344
  * @param string $meta_id ID of custom field
345
+ *
346
  * @return int Return Post ID of this view
347
  */
348
  static function post_id_from_meta_id( $meta_id ) {
413
  // Get view settings
414
  if ( $post_id ) {
415
  $view_settings = get_post_meta( $post_id, PT_CV_META_SETTINGS, true );
416
+
417
  return is_array( $view_settings ) ? $view_settings : array();
418
  }
419
 
454
  $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $pt_view_settings );
455
 
456
  // Store Display settings
457
+ global $dargs, $pt_query_args;
458
 
459
  if ( $pargs && isset( $pargs['session_id'] ) ) {
460
+ $session_id = $pargs['session_id'];
461
  }
462
 
463
+ if ( empty( $session_id ) ) {
464
+ $session_id = PT_CV_Functions::string_random();
465
  }
466
 
467
+ if ( $session_id ) {
468
+
469
+ global $pt_view_sid;
470
+ $pt_view_sid = $session_id;
471
 
472
  $session_data = array_merge(
473
  array( '$args' => '', '$dargs' => '' ),
474
+ isset( $_SESSION[PT_CV_PREFIX . 'view_' . $session_id] ) ? (array) $_SESSION[PT_CV_PREFIX . 'view_' . $session_id] : array()
475
  );
476
 
477
+ $args = $session_data['$args'];
478
  $dargs = $session_data['$dargs'];
479
  }
480
 
481
+ if ( empty( $args ) || empty( $dargs ) ) {
 
482
  /**
483
  * Get Query parameters
484
  * Set default values
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
 
530
 
531
  // Filter
532
  $dargs = apply_filters( PT_CV_PREFIX_ . 'all_display_settings', $dargs );
533
+ $args = apply_filters( PT_CV_PREFIX_ . 'query_parameters', $args );
534
 
535
  // Save settings
536
+ if ( ! empty( $session_id ) ) {
537
+ $_SESSION[PT_CV_PREFIX . 'view_' . $session_id] = array(
538
+ '$args' => $args,
539
  '$dargs' => $dargs,
540
  );
541
  }
552
  return ( implode( '</p><p>', $error ) );
553
  }
554
 
555
+ // Update global query parameters variable
556
+ $pt_query_args = $args;
557
+
558
+ do_action( PT_CV_PREFIX_ . 'add_global_variables' );
559
+
560
  /**
561
  * Output Items
562
  */
578
  global $post;
579
 
580
  // Output HTML for this item
581
+ $content_items[$post->ID] = PT_CV_Html::view_type_output( $view_type, $post );
582
  }
583
  } else {
584
  // Get no post found class
594
  // Restore original Post Data
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
602
  */
614
  // Total number of pages
615
  $max_num_pages = ceil( $total_items / $args['posts_per_page'] );
616
 
617
+ $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, $session_id );
618
  }
619
 
620
  return $html;
788
  /**
789
  * Get Fields settings
790
  *
791
+ * @param array $dargs The settings array of Fields
792
  */
793
  static function view_get_display_settings( &$dargs ) {
794
  global $pt_view_settings;
810
  * Fields settings
811
  */
812
  $cfields_settings = PT_CV_Functions::settings_values_by_prefix( PT_CV_PREFIX . 'show-field-' );
813
+ $cfields = (array) array_keys( (array) $cfields_settings );
814
  foreach ( $cfields as $field ) {
815
  // If show this field
816
  if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'show-field-' . $field, $pt_view_settings ) ) {
838
 
839
  $field_setting = array();
840
 
841
+ $prefix = PT_CV_PREFIX . 'meta-fields-';
842
  $meta_fields_settings = PT_CV_Functions::settings_values_by_prefix( PT_CV_PREFIX . 'meta-fields-' );
843
+ $fields = (array) array_keys( (array) $meta_fields_settings );
844
 
845
  PT_CV_Functions::settings_values( $fields, $field_setting, $pt_view_settings, $prefix );
846
 
875
  /**
876
  * Get Pagination settings
877
  *
878
+ * @param array $dargs The settings array of Fields
879
+ * @param array $args The parameters array
880
+ * @param array $pargs The pagination settings array
881
  */
882
  static function view_get_pagination_settings( &$dargs, &$args, $pargs ) {
883
  global $pt_view_settings;
884
 
885
  // Get Limit value
886
+ $limit = trim( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'limit', $pt_view_settings ) );
887
+ $limit = ( empty( $limit ) || $limit === '-1' ) ? 10000000 : (int) $limit;
888
  $args['limit'] = $args['posts_per_page'] = $limit;
889
+ $offset = 0;
890
 
891
  // Get pagination enable/disable
892
  $pagination = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'enable-pagination', $pt_view_settings );
917
 
918
  $offset = apply_filters( PT_CV_PREFIX_ . 'settings_args_offset', $offset );
919
 
920
+ // Set 'offset' parameter
921
+ $args['offset'] = $offset;
 
 
 
922
  }
923
 
924
  /**
925
  * Get Other settings
926
  *
927
+ * @param array $dargs The settings array of Fields
928
  */
929
  static function view_get_other_settings( &$dargs ) {
930
  global $pt_view_settings;
976
  update_post_meta( $post_id, PT_CV_META_SETTINGS, (array) $_POST );
977
 
978
  // Update post title
979
+ if ( strpos( $title, '[ID:' ) === false ) {
980
  PT_CV_Functions::post_insert( array( 'ID' => $post_id, 'title' => sprintf( '%s [ID: %s]', $title, $view_id ) ) );
981
  }
982
 
1030
  $edit_link = admin_url( 'admin.php?page=' . PT_CV_DOMAIN . '-add' );
1031
  if ( ! empty( $view_id ) ) {
1032
  $query_args = array( 'id' => $view_id );
1033
+ $edit_link = add_query_arg( $query_args, $edit_link );
1034
  }
1035
 
1036
  return $edit_link;
1070
  check_ajax_referer( PT_CV_PREFIX_ . 'ajax_nonce', 'ajax_nonce' );
1071
 
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] ) ) {
1082
  }
1083
 
1084
  // Pagination settings
1085
+ $pargs = array( 'session_id' => $sid, 'page' => (int) esc_sql( $_POST['page'] ) );
1086
 
1087
  // Show View output
1088
+ echo balanceTags( PT_CV_Functions::view_process_settings( $post_fix, $settings, $pargs ) );
1089
 
1090
  // Must exit
1091
  die;
includes/hooks.php CHANGED
@@ -38,7 +38,7 @@ if ( ! class_exists( 'PT_CV_Hooks' ) ) {
38
  // echo "<pre>";
39
  // var_dump( 'query args', $args );
40
  // echo "</pre>";
41
- ////
42
  // echo "<pre>";
43
  // var_dump( 'display args', $dargs );
44
  // echo "</pre>";
@@ -75,7 +75,7 @@ if ( ! class_exists( 'PT_CV_Hooks' ) ) {
75
 
76
  // Layout format
77
  if ( empty( $dargs['layout-format'] ) ) {
78
- $errors[] = $messages['field']['select'] . $messages['tab']['display'] . ' > ' . __( 'Layout format of an output item', PT_CV_DOMAIN );
79
  }
80
 
81
  // Field settings
38
  // echo "<pre>";
39
  // var_dump( 'query args', $args );
40
  // echo "</pre>";
41
+
42
  // echo "<pre>";
43
  // var_dump( 'display args', $dargs );
44
  // echo "</pre>";
75
 
76
  // Layout format
77
  if ( empty( $dargs['layout-format'] ) ) {
78
+ $errors[] = $messages['field']['select'] . $messages['tab']['display'] . ' > ' . __( 'Layout format', PT_CV_DOMAIN );
79
  }
80
 
81
  // Field settings
includes/html-viewtype.php CHANGED
@@ -26,7 +26,7 @@ if ( ! class_exists( 'PT_CV_Html_ViewType' ) ) {
26
  * @return array Array of rows, each row contains columns
27
  */
28
  static function grid_wrapper( $content_items, &$content ) {
29
- global $dargs;
30
 
31
  // -- Get column span
32
  $columns = ( (int) $dargs['number-columns'] < count( $content_items ) ) ? (int) $dargs['number-columns'] : count( $content_items );
@@ -52,20 +52,29 @@ if ( ! class_exists( 'PT_CV_Html_ViewType' ) ) {
52
  $row_class = implode( ' ', $row_classes );
53
 
54
  // Split items to rows
55
- $columns_item = array_chunk( $content_items, $columns );
56
 
57
  // Get HTML of each row
58
  foreach ( $columns_item as $items_per_row ) {
59
  $row_html = array();
60
 
61
- foreach ( $items_per_row as $idx => $content_item ) {
 
62
  $_span_width = ( $idx == count( $items_per_row ) - 1 ) ? $span_width_last : $span_width;
63
 
64
  // Wrap content of item
65
- $row_html[] = PT_CV_Html::content_item_wrap( $content_item, $span_class . $_span_width );
 
 
 
 
66
  }
67
 
68
- $content[] = sprintf( '<div class="%1$s">%2$s</div>', esc_attr( $row_class ), implode( "\n", $row_html ) );
 
 
 
 
69
  }
70
  }
71
 
@@ -251,8 +260,8 @@ if ( ! class_exists( 'PT_CV_Html_ViewType' ) ) {
251
  /**
252
  * HTML output of Controls in Scrollable
253
  *
254
- * @param bool $show Whether or not to show this element
255
- * @param string $wrapper_id The ID of wrapper of scrollable list
256
  * @param int $count_slides The amount of items
257
  */
258
  static function scrollable_control( $show, $wrapper_id, $count_slides ) {
26
  * @return array Array of rows, each row contains columns
27
  */
28
  static function grid_wrapper( $content_items, &$content ) {
29
+ global $dargs, $pt_cv_enable_filter;
30
 
31
  // -- Get column span
32
  $columns = ( (int) $dargs['number-columns'] < count( $content_items ) ) ? (int) $dargs['number-columns'] : count( $content_items );
52
  $row_class = implode( ' ', $row_classes );
53
 
54
  // Split items to rows
55
+ $columns_item = array_chunk( $content_items, $columns, true );
56
 
57
  // Get HTML of each row
58
  foreach ( $columns_item as $items_per_row ) {
59
  $row_html = array();
60
 
61
+ $idx = 0;
62
+ foreach ( $items_per_row as $post_id => $content_item ) {
63
  $_span_width = ( $idx == count( $items_per_row ) - 1 ) ? $span_width_last : $span_width;
64
 
65
  // Wrap content of item
66
+ $item_classes = apply_filters( PT_CV_PREFIX_ . 'item_col_class', array( $span_class . $_span_width ), $_span_width );
67
+ $item_class = implode( ' ', array_filter( $item_classes ) );
68
+ $row_html[] = PT_CV_Html::content_item_wrap( $content_item, $item_class, $post_id );
69
+
70
+ $idx ++;
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
 
260
  /**
261
  * HTML output of Controls in Scrollable
262
  *
263
+ * @param bool $show Whether or not to show this element
264
+ * @param string $wrapper_id The ID of wrapper of scrollable list
265
  * @param int $count_slides The amount of items
266
  */
267
  static function scrollable_control( $show, $wrapper_id, $count_slides ) {
includes/html.php CHANGED
@@ -216,25 +216,30 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
216
  *
217
  * @param array $html_item The HTML output of a item
218
  * @param string $class The extra wrapper class of a item, such as col span
 
219
  *
220
  * @return string Full HTML output of a item
221
  */
222
- static function content_item_wrap( $html_item, $class = '' ) {
223
  global $dargs;
224
 
225
  if ( empty( $html_item ) ) {
226
  return '';
227
  }
 
228
  if ( is_array( $dargs ) ) {
229
  // If only show Title
230
  if ( isset( $dargs['fields'] ) && count( (array) $dargs['fields'] ) == 1 && $dargs['fields'][0] === 'title' ) {
231
  $class .= ' ' . PT_CV_PREFIX . 'only-title';
232
  }
233
  }
 
234
  // Get wrapper class of a item
235
  $item_class = apply_filters( PT_CV_PREFIX_ . 'content_item_class', array( $class, PT_CV_PREFIX . 'content-item' ) );
236
 
237
- $result = sprintf( '<div class="%1$s">%2$s</div>', esc_attr( implode( ' ', $item_class ) ), balanceTags( $html_item ) );
 
 
238
 
239
  return $result;
240
  }
@@ -243,9 +248,9 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
243
  * Wrap content of all items
244
  *
245
  * @param array $content_items The array of Raw HTML output (is not wrapped) of each item
246
- * @param int $current_page The current page
247
- * @param int $post_per_page The number of posts per page
248
- * @param int $id ID of View
249
  *
250
  * @return string Full HTML output for Content View
251
  */
@@ -285,9 +290,9 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
285
  break;
286
 
287
  default :
288
- foreach ( $content_items as $content_item ) {
289
  // Wrap content of item
290
- $content[] = PT_CV_Html::content_item_wrap( $content_item );
291
  }
292
 
293
  $content = apply_filters( PT_CV_PREFIX_ . 'content_items_wrap', $content, $content_items, $current_page, $post_per_page );
@@ -328,7 +333,9 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
328
  $output = $html;
329
  }
330
 
331
- return $output;
 
 
332
  }
333
 
334
  /**
@@ -464,10 +471,17 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
464
  // Custom data
465
  $custom_attr = apply_filters( PT_CV_PREFIX_ . 'field_href_attrs', array(), $open_in, $oargs );
466
 
467
- $html = sprintf(
468
- '<a href="%s" class="%s" target="%s" %s>%s</a>',
469
- get_permalink( $post->ID ), implode( ' ', array_filter( $href_class ) ), $open_in, implode( ' ', array_filter( $custom_attr ) ), balanceTags( $content )
470
- );
 
 
 
 
 
 
 
471
 
472
  return $html;
473
  }
@@ -640,11 +654,11 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
640
  * Output pagination
641
  *
642
  * @param type $max_num_pages The total of pages
643
- * @param string $view_id The current view id
644
  *
645
  * @return type
646
  */
647
- static function pagination_output( $max_num_pages, $view_id ) {
648
  global $dargs;
649
 
650
  if ( ! $max_num_pages || (int) $max_num_pages === 1 ) {
@@ -655,9 +669,9 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
655
 
656
  $style = isset( $dargs['pagination-settings']['style'] ) ? $dargs['pagination-settings']['style'] : 'regular';
657
  if ( $style == 'regular' ) {
658
- $pagination_btn = sprintf( '<ul class="%s" data-totalpages="%s" data-id="%s"></ul>', PT_CV_PREFIX . 'pagination', esc_attr( $max_num_pages ), esc_attr( $view_id ) );
659
  } else {
660
- $pagination_btn = apply_filters( PT_CV_PREFIX_ . 'btn_more_html', $pagination_btn, $max_num_pages, $view_id );
661
  }
662
  // Add loading icon
663
  $pagination_btn .= self::html_loading_img( 12, PT_CV_PREFIX . 'spinner' );
@@ -735,6 +749,7 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
735
 
736
  /**
737
  * Scripts for Preview & WP frontend
 
738
  * @param bool $is_admin Whether or not in WP Admin
739
  */
740
  static function frontend_scripts( $is_admin = false ) {
@@ -773,7 +788,8 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
773
  * Styles for Preview & WP frontend
774
  *
775
  * @global bool $is_IE
776
- * @param bool $is_admin Whether or not in WP Admin
 
777
  */
778
  static function frontend_styles( $is_admin = false ) {
779
 
216
  *
217
  * @param array $html_item The HTML output of a item
218
  * @param string $class The extra wrapper class of a item, such as col span
219
+ * @param array $post_id The post ID
220
  *
221
  * @return string Full HTML output of a item
222
  */
223
+ static function content_item_wrap( $html_item, $class = '', $post_id = 0 ) {
224
  global $dargs;
225
 
226
  if ( empty( $html_item ) ) {
227
  return '';
228
  }
229
+
230
  if ( is_array( $dargs ) ) {
231
  // If only show Title
232
  if ( isset( $dargs['fields'] ) && count( (array) $dargs['fields'] ) == 1 && $dargs['fields'][0] === 'title' ) {
233
  $class .= ' ' . PT_CV_PREFIX . 'only-title';
234
  }
235
  }
236
+
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
+
242
+ $result = sprintf( '<div class="%s" %s>%s</div>', esc_attr( implode( ' ', $item_class ) ), $item_filter, balanceTags( $html_item ) );
243
 
244
  return $result;
245
  }
248
  * Wrap content of all items
249
  *
250
  * @param array $content_items The array of Raw HTML output (is not wrapped) of each item
251
+ * @param int $current_page The current page
252
+ * @param int $post_per_page The number of posts per page
253
+ * @param int $id ID of View
254
  *
255
  * @return string Full HTML output for Content View
256
  */
290
  break;
291
 
292
  default :
293
+ foreach ( $content_items as $post_id => $content_item ) {
294
  // Wrap content of item
295
+ $content[] = PT_CV_Html::content_item_wrap( $content_item, '', $post_id );
296
  }
297
 
298
  $content = apply_filters( PT_CV_PREFIX_ . 'content_items_wrap', $content, $content_items, $current_page, $post_per_page );
333
  $output = $html;
334
  }
335
 
336
+ $before_output = ( $current_page === 1 ) ? apply_filters( PT_CV_PREFIX_ . 'before_output_html', '' ) : '';
337
+
338
+ return $before_output . $output;
339
  }
340
 
341
  /**
471
  // Custom data
472
  $custom_attr = apply_filters( PT_CV_PREFIX_ . 'field_href_attrs', array(), $open_in, $oargs );
473
 
474
+ // Don't wrap link
475
+ $no_link = apply_filters( PT_CV_PREFIX_ . 'field_href_no_link', 0, $open_in );
476
+
477
+ if ( $no_link ) {
478
+ $html = $content;
479
+ } else {
480
+ $html = sprintf(
481
+ '<a href="%s" class="%s" target="%s" %s>%s</a>',
482
+ get_permalink( $post->ID ), implode( ' ', array_filter( $href_class ) ), $open_in, implode( ' ', array_filter( $custom_attr ) ), balanceTags( $content )
483
+ );
484
+ }
485
 
486
  return $html;
487
  }
654
  * Output pagination
655
  *
656
  * @param type $max_num_pages The total of pages
657
+ * @param string $session_id The session ID of current view
658
  *
659
  * @return type
660
  */
661
+ static function pagination_output( $max_num_pages, $session_id ) {
662
  global $dargs;
663
 
664
  if ( ! $max_num_pages || (int) $max_num_pages === 1 ) {
669
 
670
  $style = isset( $dargs['pagination-settings']['style'] ) ? $dargs['pagination-settings']['style'] : 'regular';
671
  if ( $style == 'regular' ) {
672
+ $pagination_btn = sprintf( '<ul class="%s" data-totalpages="%s" data-sid="%s"></ul>', PT_CV_PREFIX . 'pagination', esc_attr( $max_num_pages ), esc_attr( $session_id ) );
673
  } else {
674
+ $pagination_btn = apply_filters( PT_CV_PREFIX_ . 'btn_more_html', $pagination_btn, $max_num_pages, $session_id );
675
  }
676
  // Add loading icon
677
  $pagination_btn .= self::html_loading_img( 12, PT_CV_PREFIX . 'spinner' );
749
 
750
  /**
751
  * Scripts for Preview & WP frontend
752
+ *
753
  * @param bool $is_admin Whether or not in WP Admin
754
  */
755
  static function frontend_scripts( $is_admin = false ) {
788
  * Styles for Preview & WP frontend
789
  *
790
  * @global bool $is_IE
791
+ *
792
+ * @param bool $is_admin Whether or not in WP Admin
793
  */
794
  static function frontend_styles( $is_admin = false ) {
795
 
includes/settings.php CHANGED
@@ -36,18 +36,19 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
36
 
37
  foreach ( $terms_of_taxonomies as $taxonomy_slug => $terms ) {
38
 
39
- $result[$taxonomy_slug] = array(
40
-
41
  // In
42
  array(
43
  'label' => array(
44
  'text' => __( 'In ', PT_CV_DOMAIN ),
45
  //'text' => __( 'In ', PT_CV_DOMAIN ) . $taxonomies[$taxonomy_slug],
46
  ),
47
- 'params' => array(
48
  array(
49
  'type' => 'group',
50
- 'params' => apply_filters( PT_CV_PREFIX_ . 'term_quick_filter_in',
 
51
  array(
52
  array(
53
  'label' => array(
@@ -178,7 +179,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
178
  'name' => $prefix . 'items-per-page',
179
  'std' => '5',
180
  'placeholder' => 'e.g. 5',
181
- 'desc' => __( 'The number of items per page. If value of Limit option is not blank (empty), this value should be smaller than Limit value', PT_CV_DOMAIN ),
182
  ),
183
  ),
184
  'dependence' => array( 'enable-pagination', 'yes' ),
36
 
37
  foreach ( $terms_of_taxonomies as $taxonomy_slug => $terms ) {
38
 
39
+ $result[$taxonomy_slug] = array(
40
+
41
  // In
42
  array(
43
  'label' => array(
44
  'text' => __( 'In ', PT_CV_DOMAIN ),
45
  //'text' => __( 'In ', PT_CV_DOMAIN ) . $taxonomies[$taxonomy_slug],
46
  ),
47
+ 'params' => array(
48
  array(
49
  'type' => 'group',
50
+ 'params' => apply_filters(
51
+ PT_CV_PREFIX_ . 'term_quick_filter_in',
52
  array(
53
  array(
54
  'label' => array(
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
  ),
185
  'dependence' => array( 'enable-pagination', 'yes' ),
includes/values.php CHANGED
@@ -126,7 +126,7 @@ if ( ! class_exists( 'PT_CV_Values' ) ) {
126
 
127
  $args = array_merge( array( 'hide_empty' => false ), $args );
128
  $terms = get_terms( array( $taxonomy ), $args );
129
-
130
  $term_slug_name = array();
131
  foreach ( $terms as $term ) {
132
  $term_slug_name[$term->slug] = $term->name;
@@ -215,7 +215,7 @@ if ( ! class_exists( 'PT_CV_Values' ) ) {
215
  return array(
216
  'author' => __( 'Author', PT_CV_DOMAIN ),
217
  'status' => __( 'Status', PT_CV_DOMAIN ),
218
- 'taxonomy' => __( 'Taxonomy', PT_CV_DOMAIN ),
219
  'search' => __( 'Search', PT_CV_DOMAIN ),
220
  'order' => __( 'Order & Orderby', PT_CV_DOMAIN ),
221
  );
126
 
127
  $args = array_merge( array( 'hide_empty' => false ), $args );
128
  $terms = get_terms( array( $taxonomy ), $args );
129
+
130
  $term_slug_name = array();
131
  foreach ( $terms as $term ) {
132
  $term_slug_name[$term->slug] = $term->name;
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
  );
public/assets/css/public.css CHANGED
@@ -1,9 +1,9 @@
1
  /* This stylesheet is used to style the public-facing components of the plugin. */
2
 
3
  .pt-cv-view {
4
- position: relative;
5
  margin-bottom: 50px;
6
- clear: both;
7
  }
8
 
9
  /* Common */
@@ -29,9 +29,9 @@
29
 
30
  /* An Item */
31
  .pt-cv-content-item {
32
- margin-bottom: 1.875em;
33
- position: relative;
34
- overflow: hidden;
35
  }
36
 
37
  /* For the output which shows only Title */
@@ -78,12 +78,12 @@
78
  /* Meta fields */
79
  .pt-cv-meta-fields {
80
  font-size: 13px;
81
- margin-top: 15px;
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 {
@@ -92,12 +92,14 @@
92
 
93
  /* Pagination */
94
  .pt-cv-view + .pagination {
95
- float: left;
96
  margin: 0 auto !important;
97
  }
98
- .pagination>li>a {
 
99
  cursor: pointer;
100
  }
 
101
  .pt-cv-spinner {
102
  display: inline-block;
103
  opacity: 0;
@@ -117,6 +119,7 @@
117
  opacity: 1;
118
  filter: alpha(opacity=100);
119
  }
 
120
  .pt-cv-clear-pagination {
121
  margin-bottom: 50px;
122
  }
@@ -147,12 +150,12 @@
147
 
148
  /* Caption with image */
149
  .pt-cv-cap-w-img {
150
- background: rgba(0, 0, 0, 0.6);
151
- text-shadow: 0px 1px 1px #000;
152
- left: 15px !important;
153
- padding-left: 10px;
154
  padding-bottom: 0;
155
- padding-top: 10px;
156
  }
157
 
158
  .pt-cv-cap-w-img * {
1
  /* This stylesheet is used to style the public-facing components of the plugin. */
2
 
3
  .pt-cv-view {
4
+ position: relative;
5
  margin-bottom: 50px;
6
+ clear: both;
7
  }
8
 
9
  /* Common */
29
 
30
  /* An Item */
31
  .pt-cv-content-item {
32
+ padding-bottom: 1.875em;
33
+ position: relative;
34
+ overflow: hidden;
35
  }
36
 
37
  /* For the output which shows only Title */
78
  /* Meta fields */
79
  .pt-cv-meta-fields {
80
  font-size: 13px;
81
+ margin-top: 15px;
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 {
92
 
93
  /* Pagination */
94
  .pt-cv-view + .pagination {
95
+ float: left;
96
  margin: 0 auto !important;
97
  }
98
+
99
+ .pagination > li > a {
100
  cursor: pointer;
101
  }
102
+
103
  .pt-cv-spinner {
104
  display: inline-block;
105
  opacity: 0;
119
  opacity: 1;
120
  filter: alpha(opacity=100);
121
  }
122
+
123
  .pt-cv-clear-pagination {
124
  margin-bottom: 50px;
125
  }
150
 
151
  /* Caption with image */
152
  .pt-cv-cap-w-img {
153
+ background: rgba(0, 0, 0, 0.6);
154
+ text-shadow: 0px 1px 1px #000;
155
+ left: 15px !important;
156
+ padding-left: 10px;
157
  padding-bottom: 0;
158
+ padding-top: 10px;
159
  }
160
 
161
  .pt-cv-cap-w-img * {
public/assets/js/public.js CHANGED
@@ -71,7 +71,7 @@
71
  $self.doing = 1;
72
  }
73
 
74
- var view_id = this_.attr('data-id');
75
  var spinner = this_.next('.' + _prefix + 'spinner');
76
 
77
  var pagination_wrapper = this_;
@@ -81,24 +81,24 @@
81
  var pages_holder = pagination_wrapper.prev('.' + _prefix + 'view');
82
 
83
  // For Timeline
84
- if ( pages_holder.hasClass(_prefix + 'timeline') ) {
85
  pages_holder = pages_holder.children('.tl-items');
86
  }
87
 
88
- $self._get_page(view_id, selected_page, spinner, pages_holder, callback);
89
  },
90
 
91
  /**
92
  * Get wrapper of selected page
93
  *
94
- * @param string view_id The id of view
95
  * @param int selected_page The page to show
96
  * @param object spinner The jquery object of loading element
97
  * @param string pages_holder The selector expression of wrapper of pages
98
  * @param null|function callback The callback function
99
  * @returns void
100
  */
101
- _get_page: function (view_id, selected_page, spinner, pages_holder, callback) {
102
 
103
  var $self = this;
104
 
@@ -111,7 +111,7 @@
111
  // Setup data
112
  var data = {
113
  action : 'pagination_request',
114
- id : view_id,
115
  page : selected_page,
116
  ajax_nonce: PT_CV_PUBLIC._nonce
117
  };
71
  $self.doing = 1;
72
  }
73
 
74
+ var session_id = this_.attr('data-sid');
75
  var spinner = this_.next('.' + _prefix + 'spinner');
76
 
77
  var pagination_wrapper = this_;
81
  var pages_holder = pagination_wrapper.prev('.' + _prefix + 'view');
82
 
83
  // For Timeline
84
+ if (pages_holder.hasClass(_prefix + 'timeline')) {
85
  pages_holder = pages_holder.children('.tl-items');
86
  }
87
 
88
+ $self._get_page(session_id, selected_page, spinner, pages_holder, callback);
89
  },
90
 
91
  /**
92
  * Get wrapper of selected page
93
  *
94
+ * @param string session_id The session id of view
95
  * @param int selected_page The page to show
96
  * @param object spinner The jquery object of loading element
97
  * @param string pages_holder The selector expression of wrapper of pages
98
  * @param null|function callback The callback function
99
  * @returns void
100
  */
101
+ _get_page: function (session_id, selected_page, spinner, pages_holder, callback) {
102
 
103
  var $self = this;
104
 
111
  // Setup data
112
  var data = {
113
  action : 'pagination_request',
114
+ sid : session_id,
115
  page : selected_page,
116
  ajax_nonce: PT_CV_PUBLIC._nonce
117
  };