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

Version Description

  • 2018/04/09 =
  • Update: Use SEO friendly URL for normal pagination. Redirect /?vpage=NUMBER to new friendly URL depending on which page the pagination is showing on
  • Compatible Fix: Excerpt of posts created by the Cornerstone Page Builder plugin is incorrect
  • Tweak: Update content of the Settings page and description of some settings
Download this release

Release Info

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

Code changes from version 2.0.1.1 to 2.0.2

Files changed (3) hide show
  1. README.txt +3 -6
  2. content-views.php +2 -2
  3. includes/compatibility.php +15 -29
README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.contentviewspro.com/?utm_source=wporg&utm_medium=link&u
4
  Tags: post grid, grid plugin, grid, latest post, display post, post, page, category, responsive, list, thumbnail
5
  Requires at least: 3.3
6
  Tested up to: 4.9.5
7
- Stable tag: 2.0.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -163,11 +163,8 @@ If you are using "Your latest posts" as home page, you should paste this code `<
163
 
164
  == Changelog ==
165
 
166
- = 2.0.1.1 - 2018/04/05 =
167
- * Fix: Normal pagination of View does not work since version 2.0 on a single post, front page
168
-
169
- = 2.0 - 2018/04/03 =
170
- * Update: Friendly URL for normal pagination, redirect /?vpage=PAGENUM to /page/PAGENUM
171
  * Compatible Fix: Excerpt of posts created by the Cornerstone Page Builder plugin is incorrect
172
  * Tweak: Update content of the Settings page and description of some settings
173
 
4
  Tags: post grid, grid plugin, grid, latest post, display post, post, page, category, responsive, list, thumbnail
5
  Requires at least: 3.3
6
  Tested up to: 4.9.5
7
+ Stable tag: 2.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
163
 
164
  == Changelog ==
165
 
166
+ = 2.0.2 - 2018/04/09 =
167
+ * Update: Use SEO friendly URL for normal pagination. Redirect /?vpage=NUMBER to new friendly URL depending on which page the pagination is showing on
 
 
 
168
  * Compatible Fix: Excerpt of posts created by the Cornerstone Page Builder plugin is incorrect
169
  * Tweak: Update content of the Settings page and description of some settings
170
 
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: 2.0.1.1
14
  * Author: CVSOFT LLC
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views-query-and-display-post-page
@@ -25,7 +25,7 @@ if ( !defined( 'ABSPATH' ) ) {
25
  }
26
 
27
  // Define Constant
28
- define( 'PT_CV_VERSION', '2.0.1.1' );
29
  define( 'PT_CV_FILE', __FILE__ );
30
  define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
31
  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: 2.0.2
14
  * Author: CVSOFT LLC
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views-query-and-display-post-page
25
  }
26
 
27
  // Define Constant
28
+ define( 'PT_CV_VERSION', '2.0.2' );
29
  define( 'PT_CV_FILE', __FILE__ );
30
  define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
31
  include_once( PT_CV_PATH . 'includes/defines.php' );
includes/compatibility.php CHANGED
@@ -313,30 +313,19 @@ function cv_comp_plugin_saoe() {
313
  remove_filter( 'get_post_metadata', 'jr_saoe_get_post_metadata', 10 );
314
  }
315
 
316
- /** Redirect old /?vpage= to /?paged=
317
  * @since 2.0
318
  */
319
- add_action( 'get_header', 'cv_comp_common_redirect_vpage', 11 );
320
  function cv_comp_common_redirect_vpage() {
321
  // The pagination variable name
322
- $pvar = (is_front_page() || !is_singular()) ? 'paged' : 'page';
323
-
324
- // For CVP
325
- if ( method_exists( 'CVP_Replace_Layout', 'get_instance' ) && class_exists( 'ReflectionClass' ) ) {
326
- try {
327
- $rep = CVP_Replace_Layout::get_instance();
328
- $reflectionClass = new ReflectionClass( $rep );
329
- $reflectionProperty = $reflectionClass->getProperty( 'which_view' );
330
- $reflectionProperty->setAccessible( true );
331
- $sview = $reflectionProperty->getValue( $rep );
332
- if ( !is_feed() && !is_admin() && $sview ) {
333
- $pvar = '_page'; /* the friendly parameter won't work, it requires modifying posts_per_page in pre_get_posts */
334
- }
335
- } catch ( ReflectionException $exc ) {
336
-
337
- }
338
  }
339
-
340
  $GLOBALS[ 'cv_page_var' ] = apply_filters( PT_CV_PREFIX_ . 'page_var', $pvar );
341
 
342
  if ( !empty( $_GET[ 'vpage' ] ) && !headers_sent() ) {
@@ -366,17 +355,14 @@ function cv_comp_pro_timeline() {
366
  * @return string
367
  */
368
  function cv_comp_get_pagenum_link( $pagenum ) {
369
- if ( is_singular() && !is_preview() ) {
370
- $link = get_permalink();
371
- if ( '' == get_option( 'permalink_structure' ) ) {
372
- $link = add_query_arg( $GLOBALS[ 'cv_page_var' ], $pagenum, $link );
373
- } else {
374
- global $wp_rewrite;
375
- $extra = is_front_page() ? trailingslashit( $wp_rewrite->pagination_base ) : '';
376
- $link = user_trailingslashit( trailingslashit( $link ) . $extra . $pagenum );
377
- }
378
  } else {
379
- $link = add_query_arg( $GLOBALS[ 'cv_page_var' ], $pagenum );
380
  }
381
 
382
  return remove_query_arg( 'vpage', $link );
313
  remove_filter( 'get_post_metadata', 'jr_saoe_get_post_metadata', 10 );
314
  }
315
 
316
+ /** Redirect old /?vpage=
317
  * @since 2.0
318
  */
319
+ add_action( 'init', 'cv_comp_common_redirect_vpage', 1 );
320
  function cv_comp_common_redirect_vpage() {
321
  // The pagination variable name
322
+ if ( is_front_page() && !is_home() ) {
323
+ $pvar = 'paged';
324
+ } else if ( is_singular() ) {
325
+ $pvar = 'page';
326
+ } else {
327
+ $pvar = '_page';
 
 
 
 
 
 
 
 
 
 
328
  }
 
329
  $GLOBALS[ 'cv_page_var' ] = apply_filters( PT_CV_PREFIX_ . 'page_var', $pvar );
330
 
331
  if ( !empty( $_GET[ 'vpage' ] ) && !headers_sent() ) {
355
  * @return string
356
  */
357
  function cv_comp_get_pagenum_link( $pagenum ) {
358
+ $pvar = $GLOBALS[ 'cv_page_var' ];
359
+ if ( '' != get_option( 'permalink_structure' ) && in_array( $pvar, array( 'page', 'paged' ) ) && !is_preview() ) {
360
+ global $wp_rewrite;
361
+ $link = get_permalink();
362
+ $extra = ($pvar === 'paged') ? trailingslashit( $wp_rewrite->pagination_base ) : '';
363
+ $link = user_trailingslashit( trailingslashit( $link ) . $extra . $pagenum );
 
 
 
364
  } else {
365
+ $link = add_query_arg( $pvar, $pagenum );
366
  }
367
 
368
  return remove_query_arg( 'vpage', $link );