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

Version Description

  • November 05 2016 =
  • Tweak: Update message when something went wrong, show exact error in Preview panel
  • Tweak: Update description for keyword setting
  • Tweak: Introduce filter "pt_cv_link_html" to modify HTML output of title, thumbnail, read-more button
Download this release

Release Info

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

Code changes from version 1.9.2 to 1.9.2.1

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.contentviewspro.com/pricing/?utm_source=wporg&utm_mediu
4
  Tags: post, posts, page, pages, grid, author, category, categories, tag, responsive, title, thumbnail, content
5
  Requires at least: 3.3
6
  Tested up to: 4.6.1
7
- Stable tag: 1.9.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -116,6 +116,11 @@ If you are using "Your latest posts" as home page, you should paste this code `<
116
 
117
  == Changelog ==
118
 
 
 
 
 
 
119
  = 1.9.2 - October 24 2016 =
120
  * Fix: [Compatibility with FacetWP plugin] empty settings (View does not exist), missing posts in output when reload page after filtering by FacetWP search form
121
  * Revert force_balance_tags() for item HTML wrapper, to prevent broken output
4
  Tags: post, posts, page, pages, grid, author, category, categories, tag, responsive, title, thumbnail, content
5
  Requires at least: 3.3
6
  Tested up to: 4.6.1
7
+ Stable tag: 1.9.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
116
 
117
  == Changelog ==
118
 
119
+ = 1.9.2.1 - November 05 2016 =
120
+ * Tweak: Update message when something went wrong, show exact error in Preview panel
121
+ * Tweak: Update description for keyword setting
122
+ * Tweak: Introduce filter "pt_cv_link_html" to modify HTML output of title, thumbnail, read-more button
123
+
124
  = 1.9.2 - October 24 2016 =
125
  * Fix: [Compatibility with FacetWP plugin] empty settings (View does not exist), missing posts in output when reload page after filtering by FacetWP search form
126
  * Revert force_balance_tags() for item HTML wrapper, to prevent broken output
admin/content-views-admin.php CHANGED
@@ -108,7 +108,7 @@ class PT_Content_Views_Admin {
108
  global $pagenow;
109
  if ( $pagenow === 'post-new.php' ) {
110
  $post_type = isset( $_GET[ 'post_type' ] ) ? $_GET[ 'post_type' ] : '';
111
- if ( $post_type === PT_CV_POST_TYPE ) {
112
  wp_redirect( admin_url( 'admin.php?page=' . $this->plugin_slug . '-add' ), 301 );
113
  exit;
114
  }
@@ -423,18 +423,16 @@ class PT_Content_Views_Admin {
423
  * Filter link of Title in All Views page
424
  */
425
  public function filter_get_edit_post_link( $edit_link, $post_id, $context ) {
426
-
427
- // Get current post type
428
  $post_type = PT_CV_Functions::admin_current_post_type();
429
 
430
  if ( $post_type != PT_CV_POST_TYPE ) {
431
  return $edit_link;
432
  }
433
 
434
- // Get View id
435
- $view_id = get_post_meta( $post_id, PT_CV_META_ID, true );
436
-
437
- $edit_link = PT_CV_Functions::view_link( $view_id );
438
 
439
  return $edit_link;
440
  }
108
  global $pagenow;
109
  if ( $pagenow === 'post-new.php' ) {
110
  $post_type = isset( $_GET[ 'post_type' ] ) ? $_GET[ 'post_type' ] : '';
111
+ if ( apply_filters( PT_CV_PREFIX_ . 'modify_post_url', $post_type === PT_CV_POST_TYPE ) ) {
112
  wp_redirect( admin_url( 'admin.php?page=' . $this->plugin_slug . '-add' ), 301 );
113
  exit;
114
  }
423
  * Filter link of Title in All Views page
424
  */
425
  public function filter_get_edit_post_link( $edit_link, $post_id, $context ) {
 
 
426
  $post_type = PT_CV_Functions::admin_current_post_type();
427
 
428
  if ( $post_type != PT_CV_POST_TYPE ) {
429
  return $edit_link;
430
  }
431
 
432
+ if ( apply_filters( PT_CV_PREFIX_ . 'modify_post_url', true ) ) {
433
+ $view_id = get_post_meta( $post_id, PT_CV_META_ID, true );
434
+ $edit_link = PT_CV_Functions::view_link( $view_id );
435
+ }
436
 
437
  return $edit_link;
438
  }
admin/views/view.php CHANGED
@@ -12,7 +12,8 @@
12
  $version_gt_37 = PT_CV_Functions::wp_version_compare( '3.7' );
13
 
14
  $settings = array();
15
- $id = $post_id = 0;
 
16
 
17
  // Check if this is edit View page
18
  if ( !empty( $_GET[ 'id' ] ) ) {
@@ -450,7 +451,7 @@ PT_CV_Functions::view_submit();
450
  'type' => 'text',
451
  'name' => 's',
452
  'std' => '',
453
- 'desc' => __( 'Enter keyword to searching for posts', 'content-views-query-and-display-post-page' ) . apply_filters( PT_CV_PREFIX_ . 'searchby_keyword_desc', '' ),
454
  ),
455
  ),
456
  ),
12
  $version_gt_37 = PT_CV_Functions::wp_version_compare( '3.7' );
13
 
14
  $settings = array();
15
+ $id = 0;
16
+ $post_id = apply_filters( PT_CV_PREFIX_ . 'view_post_id', 0 );
17
 
18
  // Check if this is edit View page
19
  if ( !empty( $_GET[ 'id' ] ) ) {
451
  'type' => 'text',
452
  'name' => 's',
453
  'std' => '',
454
+ 'desc' => __( 'Enter keyword to searching for posts', 'content-views-query-and-display-post-page' ) . apply_filters( PT_CV_PREFIX_ . 'searchby_keyword_desc', '' ) . '<br>' . __( 'It will search keyword in tile, excerpt, content of posts', 'content-views-query-and-display-post-page' ),
455
  ),
456
  ),
457
  ),
content-views.php CHANGED
@@ -11,7 +11,7 @@
11
  * Plugin Name: Content Views
12
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
13
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
14
- * Version: 1.9.2
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views-query-and-display-post-page
@@ -26,7 +26,7 @@ if ( !defined( 'ABSPATH' ) ) {
26
  }
27
 
28
  // Define Constant
29
- define( 'PT_CV_VERSION', '1.9.2' );
30
  define( 'PT_CV_FILE', __FILE__ );
31
  define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
32
  include_once( PT_CV_PATH . 'includes/defines.php' );
11
  * Plugin Name: Content Views
12
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
13
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
14
+ * Version: 1.9.2.1
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views-query-and-display-post-page
26
  }
27
 
28
  // Define Constant
29
+ define( 'PT_CV_VERSION', '1.9.2.1' );
30
  define( 'PT_CV_FILE', __FILE__ );
31
  define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
32
  include_once( PT_CV_PATH . 'includes/defines.php' );
includes/functions.php CHANGED
@@ -607,8 +607,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
607
  * @return string View output
608
  */
609
  static function view_process_settings( $view_id, $settings, $pargs = array(), $sc_params = NULL ) {
610
- if ( empty( $settings[ PT_CV_PREFIX . 'view-type' ] ) ) {
611
- return sprintf( __( 'Empty settings (View %s does not exist)', 'content-views-query-and-display-post-page' ), "<strong>$view_id</strong>" );
612
  }
613
 
614
  global $pt_cv_glb, $pt_cv_id;
@@ -1144,7 +1144,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1144
  public static function view_link( $view_id, $action = array() ) {
1145
  $edit_link = admin_url( 'admin.php?page=' . PT_CV_DOMAIN . '-add' );
1146
  if ( !empty( $view_id ) ) {
1147
- $query_args = array( 'id' => $view_id ) + $action;
1148
  $edit_link = add_query_arg( $query_args, $edit_link );
1149
  }
1150
 
607
  * @return string View output
608
  */
609
  static function view_process_settings( $view_id, $settings, $pargs = array(), $sc_params = NULL ) {
610
+ if ( !defined( 'PT_CV_DOING_PREVIEW' ) && empty( $settings[ PT_CV_PREFIX . 'view-type' ] ) ) {
611
+ return sprintf( __( 'Error: View %s may not exist', 'content-views-query-and-display-post-page' ), "<strong>$view_id</strong>" );
612
  }
613
 
614
  global $pt_cv_glb, $pt_cv_id;
1144
  public static function view_link( $view_id, $action = array() ) {
1145
  $edit_link = admin_url( 'admin.php?page=' . PT_CV_DOMAIN . '-add' );
1146
  if ( !empty( $view_id ) ) {
1147
+ $query_args = apply_filters( PT_CV_PREFIX_ . 'view_link_args', array( 'id' => $view_id ) + $action );
1148
  $edit_link = add_query_arg( $query_args, $edit_link );
1149
  }
1150
 
includes/html.php CHANGED
@@ -480,7 +480,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
480
  $custom_attr = apply_filters( PT_CV_PREFIX_ . 'field_href_attrs', array(), $open_in, $oargs );
481
  $html = sprintf( '<a href="%s" class="%s" target="%s" %s>%s</a>', esc_url( $href ), esc_attr( implode( ' ', array_filter( $href_class ) ) ), esc_attr( $open_in ), cv_sanitize_html_data( implode( ' ', $custom_attr ) ), $content );
482
 
483
- return $html;
484
  }
485
 
486
  /**
480
  $custom_attr = apply_filters( PT_CV_PREFIX_ . 'field_href_attrs', array(), $open_in, $oargs );
481
  $html = sprintf( '<a href="%s" class="%s" target="%s" %s>%s</a>', esc_url( $href ), esc_attr( implode( ' ', array_filter( $href_class ) ) ), esc_attr( $open_in ), cv_sanitize_html_data( implode( ' ', $custom_attr ) ), $content );
482
 
483
+ return apply_filters( PT_CV_PREFIX_ . 'link_html', $html, array( $post, $content, $defined_class ) );
484
  }
485
 
486
  /**