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

Version Description

  • Test up to 4.1
  • Improvement: Add shortcode column to All Views page
  • Improvement: Add some css properties to prevent style overwrite problem
Download this release

Release Info

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

Code changes from version 1.4.4 to 1.4.5

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: pt-guy
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
4
  Tags: post, posts, page, pages, query, queries, search, display, show, grid, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
5
  Requires at least: 3.3
6
- Tested up to: 4.0.1
7
- Stable tag: 1.4.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -144,6 +144,11 @@ You can create Unlimited Views, in Unlimited websites
144
 
145
  == Changelog ==
146
 
 
 
 
 
 
147
  = 1.4.4 =
148
  * Bug fixed: Length of excerpt is wrong if there is filter of other plugin or active theme
149
  * Improvement: GUI improvement in "Fields settings" group
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, grid, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
5
  Requires at least: 3.3
6
+ Tested up to: 4.1
7
+ Stable tag: 1.4.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
144
 
145
  == Changelog ==
146
 
147
+ = 1.4.5 =
148
+ * Test up to 4.1
149
+ * Improvement: Add shortcode column to All Views page
150
+ * Improvement: Add some css properties to prevent style overwrite problem
151
+
152
  = 1.4.4 =
153
  * Bug fixed: Length of excerpt is wrong if there is filter of other plugin or active theme
154
  * Improvement: GUI improvement in "Fields settings" group
admin/assets/css/admin.css CHANGED
@@ -12,6 +12,10 @@
12
  .update-nag {
13
  display: none;
14
  }
 
 
 
 
15
 
16
  /* Fix Bootstrap box-sizing "border-box" problem */
17
  .pt-wrap *,
12
  .update-nag {
13
  display: none;
14
  }
15
+ .pt-wrap a:focus {
16
+ -webkit-box-shadow: none !important;
17
+ box-shadow: none !important;
18
+ }
19
 
20
  /* Fix Bootstrap box-sizing "border-box" problem */
21
  .pt-wrap *,
admin/assets/js/admin.js CHANGED
@@ -261,7 +261,7 @@
261
  // Remove highlight color
262
  setTimeout(function () {
263
  $(toggle_id).removeClass(activate_group);
264
- }, 3000);
265
 
266
  } else {
267
  $('#' + id_prefix + $this.val()).addClass('hidden');
261
  // Remove highlight color
262
  setTimeout(function () {
263
  $(toggle_id).removeClass(activate_group);
264
+ }, 2000);
265
 
266
  } else {
267
  $('#' + id_prefix + $this.val()).addClass('hidden');
admin/content-views-admin.php CHANGED
@@ -84,6 +84,10 @@ class PT_Content_Views_Admin {
84
  // Filter link of actions in All Views page
85
  add_filter( 'post_row_actions', array( $this, 'filter_view_row_actions' ), 10, 2 );
86
 
 
 
 
 
87
  // Filter link of Title in All Views page
88
  add_filter( 'get_edit_post_link', array( $this, 'filter_get_edit_post_link' ), 10, 3 );
89
 
@@ -200,7 +204,7 @@ class PT_Content_Views_Admin {
200
  // Bootstrap for Admin
201
  PT_CV_Asset::enqueue(
202
  'bootstrap-admin', 'style', array(
203
- 'src' => plugins_url( 'assets/bootstrap/css/bootstrap.full.min.css', PT_CV_FILE ),
204
  )
205
  );
206
 
@@ -292,10 +296,14 @@ class PT_Content_Views_Admin {
292
  /*
293
  * Add a settings page for this plugin to the Settings menu.
294
  */
 
 
 
 
295
  $this->plugin_screen_hook_suffix = add_menu_page(
296
  __( 'Content View Settings', $this->plugin_slug ),
297
  __( 'Content View Settings', $this->plugin_slug ),
298
- 'edit_posts',
299
  $this->plugin_slug,
300
  array( $this, 'display_plugin_admin_page' ),
301
  '',
@@ -306,6 +314,7 @@ class PT_Content_Views_Admin {
306
  $this->plugin_slug,
307
  __( 'All Content Views', $this->plugin_slug ),
308
  __( 'All Views', $this->plugin_slug ),
 
309
  'list',
310
  __CLASS__
311
  );
@@ -314,12 +323,28 @@ class PT_Content_Views_Admin {
314
  $this->plugin_slug,
315
  __( 'Add New View', $this->plugin_slug ),
316
  __( 'Add New', $this->plugin_slug ),
 
317
  'add',
318
  __CLASS__
319
  );
320
 
321
  }
322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  /**
324
  * Render the settings page for this plugin.
325
  *
@@ -398,6 +423,22 @@ class PT_Content_Views_Admin {
398
  return $actions;
399
  }
400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
  /**
402
  * Filter link of Title in All Views page
403
  */
84
  // Filter link of actions in All Views page
85
  add_filter( 'post_row_actions', array( $this, 'filter_view_row_actions' ), 10, 2 );
86
 
87
+ // Add Shortcode column
88
+ add_filter( 'manage_pt_view_posts_columns', array( $this, 'filter_view_custom_column_header' ) );
89
+ add_action( 'manage_pt_view_posts_custom_column', array( $this, 'action_view_custom_column_content' ), 10, 2 );
90
+
91
  // Filter link of Title in All Views page
92
  add_filter( 'get_edit_post_link', array( $this, 'filter_get_edit_post_link' ), 10, 3 );
93
 
204
  // Bootstrap for Admin
205
  PT_CV_Asset::enqueue(
206
  'bootstrap-admin', 'style', array(
207
+ 'src' => plugins_url( 'assets/bootstrap/css/bootstrap.admin.css', PT_CV_FILE ),
208
  )
209
  );
210
 
296
  /*
297
  * Add a settings page for this plugin to the Settings menu.
298
  */
299
+ // Get user role settings option
300
+ $options = get_option( PT_CV_OPTION_NAME );
301
+ $user_role = current_user_can( 'administrator' ) ? 'administrator' : ( isset( $options['access_role'] ) ? $options['access_role'] : 'edit_posts' );
302
+
303
  $this->plugin_screen_hook_suffix = add_menu_page(
304
  __( 'Content View Settings', $this->plugin_slug ),
305
  __( 'Content View Settings', $this->plugin_slug ),
306
+ $user_role,
307
  $this->plugin_slug,
308
  array( $this, 'display_plugin_admin_page' ),
309
  '',
314
  $this->plugin_slug,
315
  __( 'All Content Views', $this->plugin_slug ),
316
  __( 'All Views', $this->plugin_slug ),
317
+ $user_role,
318
  'list',
319
  __CLASS__
320
  );
323
  $this->plugin_slug,
324
  __( 'Add New View', $this->plugin_slug ),
325
  __( 'Add New', $this->plugin_slug ),
326
+ $user_role,
327
  'add',
328
  __CLASS__
329
  );
330
 
331
  }
332
 
333
+ /**
334
+ * Admin custom column content
335
+ *
336
+ * @param type $column_name
337
+ * @param type $post_id
338
+ */
339
+ public function action_view_custom_column_content( $column_name, $post_id ) {
340
+ if ( $column_name == 'shortcode' ) {
341
+ // Get View id
342
+ $view_id = get_post_meta( $post_id, PT_CV_META_ID, true );
343
+
344
+ printf( '<input style="width: 250px; background: #ADFFAD;" type="text" value="[pt_view id=&quot;%s&quot;]" onclick="this.select()" readonly="">', $view_id );
345
+ }
346
+ }
347
+
348
  /**
349
  * Render the settings page for this plugin.
350
  *
423
  return $actions;
424
  }
425
 
426
+ /**
427
+ * Modify column in View list page (Admin)
428
+ *
429
+ * @param type $defaults
430
+ */
431
+ public function filter_view_custom_column_header( $defaults ) {
432
+ unset( $defaults['author'] );
433
+ unset( $defaults['date'] );
434
+
435
+ $defaults['shortcode'] = __( 'Shortcode' );
436
+ $defaults['author'] = __( 'Author' );
437
+ $defaults['date'] = __( 'Date' );
438
+
439
+ return $defaults;
440
+ }
441
+
442
  /**
443
  * Filter link of Title in All Views page
444
  */
assets/bootstrap/css/{bootstrap.full.min.css → bootstrap.admin.css} RENAMED
File without changes
content-views.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
- * Version: 1.4.4
14
  * Author: PT Guy
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views
@@ -27,7 +27,7 @@ if ( ! defined( 'WPINC' ) ) {
27
  /*
28
  * Define Constant
29
  */
30
- define( 'PT_CV_VERSION', '1.4.4' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
+ * Version: 1.4.5
14
  * Author: PT Guy
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views
27
  /*
28
  * Define Constant
29
  */
30
+ define( 'PT_CV_VERSION', '1.4.5' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
includes/functions.php CHANGED
@@ -78,14 +78,11 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
78
  * @param string $parent_slug Slug of parent menu
79
  * @param string $page_title Title of page
80
  * @param string $menu_title Title of menu
 
81
  * @param string $sub_page Slug of sub menu
82
  * @param string $class Class name which contains function to output content of page created by this menu
83
  */
84
- static function menu_add_sub( $parent_slug, $page_title, $menu_title, $sub_page, $class ) {
85
- // Get user role settings option
86
- $options = get_option( PT_CV_OPTION_NAME );
87
- $user_role = current_user_can( 'administrator' ) ? 'administrator' : ( isset( $options['access_role'] ) ? $options['access_role'] : 'edit_posts' );
88
-
89
  return add_submenu_page(
90
  $parent_slug, $page_title, $menu_title, $user_role, $parent_slug . '-' . $sub_page, array( $class, 'display_sub_page_' . $sub_page )
91
  );
@@ -190,6 +187,9 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
190
  $result = implode( ' ', $array );
191
  }
192
 
 
 
 
193
  return $result;
194
  }
195
 
78
  * @param string $parent_slug Slug of parent menu
79
  * @param string $page_title Title of page
80
  * @param string $menu_title Title of menu
81
+ * @param string $user_role Required role to see this menu
82
  * @param string $sub_page Slug of sub menu
83
  * @param string $class Class name which contains function to output content of page created by this menu
84
  */
85
+ static function menu_add_sub( $parent_slug, $page_title, $menu_title, $user_role, $sub_page, $class ) {
 
 
 
 
86
  return add_submenu_page(
87
  $parent_slug, $page_title, $menu_title, $user_role, $parent_slug . '-' . $sub_page, array( $class, 'display_sub_page_' . $sub_page )
88
  );
187
  $result = implode( ' ', $array );
188
  }
189
 
190
+ // Trim space, dot at the end of string
191
+ $result = rtrim( $result, '\s.' );
192
+
193
  return $result;
194
  }
195
 
includes/html.php CHANGED
@@ -540,8 +540,9 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
540
  // Don't wrap link
541
  $no_link = apply_filters( PT_CV_PREFIX_ . 'field_href_no_link', 0, $open_in );
542
 
 
 
543
  // Change href
544
- $href = get_permalink( $post->ID );
545
  if ( $no_link && strpos( $defined_class, 'readmore' ) === false ) {
546
  $href = 'javascript:void(0)';
547
  }
540
  // Don't wrap link
541
  $no_link = apply_filters( PT_CV_PREFIX_ . 'field_href_no_link', 0, $open_in );
542
 
543
+ $href = apply_filters( PT_CV_PREFIX_ . 'field_href', get_permalink( $post->ID ) );
544
+
545
  // Change href
 
546
  if ( $no_link && strpos( $defined_class, 'readmore' ) === false ) {
547
  $href = 'javascript:void(0)';
548
  }
public/assets/css/public.css CHANGED
@@ -37,8 +37,8 @@
37
 
38
  /* Link */
39
  .pt-cv-view a {
40
- /*color: #000;*/
41
  text-decoration: none !important;
 
42
  }
43
 
44
  .pt-cv-view a:hover, .pt-cv-view .panel-heading:hover a {
@@ -60,7 +60,7 @@
60
 
61
  /* Add default margin-bottom */
62
  .pt-cv-content-item > * {
63
- margin-bottom: 10px;
64
  }
65
 
66
  /* For the output which shows only Title */
@@ -82,6 +82,7 @@
82
  .pt-cv-thumbnail {
83
  height: auto;
84
  max-width: 100% !important;
 
85
  margin-bottom: 15px !important;
86
  min-width: inherit !important;
87
  }
@@ -132,14 +133,15 @@
132
  }
133
 
134
  .pt-cv-spinner {
 
 
 
 
135
  display: inline-block;
136
  opacity: 0;
137
  filter: alpha(opacity=0);
138
  color: #0470ec;
139
 
140
- margin-top: 12px;
141
- margin-left: 10px;
142
-
143
  -webkit-transition: opacity 0.25s, width 0.25s;
144
  -moz-transition: opacity 0.25s, width 0.25s;
145
  -o-transition: opacity 0.25s, width 0.25s;
37
 
38
  /* Link */
39
  .pt-cv-view a {
 
40
  text-decoration: none !important;
41
+ outline: 0 !important;
42
  }
43
 
44
  .pt-cv-view a:hover, .pt-cv-view .panel-heading:hover a {
60
 
61
  /* Add default margin-bottom */
62
  .pt-cv-content-item > * {
63
+ margin-bottom: 10px !important;
64
  }
65
 
66
  /* For the output which shows only Title */
82
  .pt-cv-thumbnail {
83
  height: auto;
84
  max-width: 100% !important;
85
+ margin-top: 0 !important;
86
  margin-bottom: 15px !important;
87
  min-width: inherit !important;
88
  }
133
  }
134
 
135
  .pt-cv-spinner {
136
+ position: absolute;
137
+ top: 66px;
138
+ margin: 0 auto !important;
139
+
140
  display: inline-block;
141
  opacity: 0;
142
  filter: alpha(opacity=0);
143
  color: #0470ec;
144
 
 
 
 
145
  -webkit-transition: opacity 0.25s, width 0.25s;
146
  -moz-transition: opacity 0.25s, width 0.25s;
147
  -o-transition: opacity 0.25s, width 0.25s;
public/assets/js/public.js CHANGED
@@ -156,11 +156,11 @@
156
  data : data,
157
  beforeSend: function () {
158
  // Show loading icon
159
- spinner.toggleClass('active');
160
  }
161
  }).done(function (response) {
162
  // Hide loading icon
163
- spinner.toggleClass('active');
164
 
165
  // Update content of Preview box
166
  pages_holder.append(response);
156
  data : data,
157
  beforeSend: function () {
158
  // Show loading icon
159
+ spinner.addClass('active');
160
  }
161
  }).done(function (response) {
162
  // Hide loading icon
163
+ spinner.removeClass('active');
164
 
165
  // Update content of Preview box
166
  pages_holder.append(response);