Version Description
- 2018/04/05 =
- Fix: Normal pagination of View does not work since version 2.0 on a single post, front page
Download this release
Release Info
Developer | PT Guy |
Plugin | Content Views – Post Grid & List for WordPress |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.0.1
- README.txt +4 -1
- content-views.php +2 -2
- includes/compatibility.php +59 -4
- includes/functions.php +2 -2
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
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -163,6 +163,9 @@ If you are using "Your latest posts" as home page, you should paste this code `<
|
|
163 |
|
164 |
== Changelog ==
|
165 |
|
|
|
|
|
|
|
166 |
= 2.0 - 2018/04/03 =
|
167 |
* Update: Friendly URL for normal pagination, redirect /?vpage=PAGENUM to /page/PAGENUM
|
168 |
* Compatible Fix: Excerpt of posts created by the Cornerstone Page Builder plugin is incorrect
|
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
|
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.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
|
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
|
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' );
|
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.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 |
}
|
26 |
|
27 |
// Define Constant
|
28 |
+
define( 'PT_CV_VERSION', '2.0.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' );
|
includes/compatibility.php
CHANGED
@@ -98,7 +98,7 @@ function cv_comp_plugin_cornerstone_core( $args, $fargs, $this_post ) {
|
|
98 |
$cache = $this_post->cv_comp_cornerstone_content;
|
99 |
if ( empty( $cache ) || $cache[ 'expires' ] < time() ) {
|
100 |
// Simulate the frontend, to get processed output by Cornerstone
|
101 |
-
file_get_contents( add_query_arg( 'cv_comp_cs_content', 1, get_permalink( $this_post->ID ) ) );
|
102 |
// Get the processed content
|
103 |
$cache = get_post_meta( $this_post->ID, 'cv_comp_cornerstone_content', true );
|
104 |
}
|
@@ -316,12 +316,30 @@ function cv_comp_plugin_saoe() {
|
|
316 |
/** Redirect old /?vpage= to /?paged=
|
317 |
* @since 2.0
|
318 |
*/
|
319 |
-
add_action( '
|
320 |
function cv_comp_common_redirect_vpage() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
if ( !empty( $_GET[ 'vpage' ] ) && !headers_sent() ) {
|
322 |
$pagenum = absint( $_GET[ 'vpage' ] );
|
323 |
if ( $pagenum >= 1 ) {
|
324 |
-
$new_url =
|
325 |
wp_safe_redirect( $new_url, 301 );
|
326 |
exit;
|
327 |
}
|
@@ -333,8 +351,45 @@ function cv_comp_common_redirect_vpage() {
|
|
333 |
*/
|
334 |
add_action( PT_CV_PREFIX_ . 'view_process_start', 'cv_comp_pro_timeline' );
|
335 |
function cv_comp_pro_timeline() {
|
336 |
-
$pagenum =
|
337 |
if ( !empty( $pagenum ) ) {
|
338 |
$_GET[ 'vpage' ] = 'notempty'; /* not empty value is enough for compatibility */
|
339 |
}
|
340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
$cache = $this_post->cv_comp_cornerstone_content;
|
99 |
if ( empty( $cache ) || $cache[ 'expires' ] < time() ) {
|
100 |
// Simulate the frontend, to get processed output by Cornerstone
|
101 |
+
@file_get_contents( add_query_arg( 'cv_comp_cs_content', 1, get_permalink( $this_post->ID ) ) );
|
102 |
// Get the processed content
|
103 |
$cache = get_post_meta( $this_post->ID, 'cv_comp_cornerstone_content', true );
|
104 |
}
|
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' ) ) {
|
326 |
+
$rep = CVP_Replace_Layout::get_instance();
|
327 |
+
|
328 |
+
ob_start();
|
329 |
+
var_dump( $rep );
|
330 |
+
$obj_info = ob_get_clean();
|
331 |
+
|
332 |
+
if ( !is_feed() && !is_admin() && preg_match( '/which_view.*string/', $obj_info ) ) {
|
333 |
+
$pvar = '_page'; /* the friendly parameter won't work, it requires modifying posts_per_page in pre_get_posts */
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
$GLOBALS[ 'cv_page_var' ] = apply_filters( PT_CV_PREFIX_ . 'page_var', $pvar );
|
338 |
+
|
339 |
if ( !empty( $_GET[ 'vpage' ] ) && !headers_sent() ) {
|
340 |
$pagenum = absint( $_GET[ 'vpage' ] );
|
341 |
if ( $pagenum >= 1 ) {
|
342 |
+
$new_url = cv_comp_get_pagenum_link( $pagenum );
|
343 |
wp_safe_redirect( $new_url, 301 );
|
344 |
exit;
|
345 |
}
|
351 |
*/
|
352 |
add_action( PT_CV_PREFIX_ . 'view_process_start', 'cv_comp_pro_timeline' );
|
353 |
function cv_comp_pro_timeline() {
|
354 |
+
$pagenum = cv_comp_get_page_number();
|
355 |
if ( !empty( $pagenum ) ) {
|
356 |
$_GET[ 'vpage' ] = 'notempty'; /* not empty value is enough for compatibility */
|
357 |
}
|
358 |
}
|
359 |
+
|
360 |
+
/** Generate page numeric link for Normal pagination
|
361 |
+
*
|
362 |
+
* @param int $pagenum
|
363 |
+
* @return string
|
364 |
+
*/
|
365 |
+
function cv_comp_get_pagenum_link( $pagenum ) {
|
366 |
+
if ( is_singular() && !is_preview() ) {
|
367 |
+
$link = get_permalink();
|
368 |
+
if ( '' == get_option( 'permalink_structure' ) ) {
|
369 |
+
$link = add_query_arg( $GLOBALS[ 'cv_page_var' ], $pagenum, $link );
|
370 |
+
} else {
|
371 |
+
global $wp_rewrite;
|
372 |
+
$extra = is_front_page() ? trailingslashit( $wp_rewrite->pagination_base ) : '';
|
373 |
+
$link = user_trailingslashit( trailingslashit( $link ) . $extra . $pagenum );
|
374 |
+
}
|
375 |
+
} else {
|
376 |
+
$link = add_query_arg( $GLOBALS[ 'cv_page_var' ], $pagenum );
|
377 |
+
}
|
378 |
+
|
379 |
+
return remove_query_arg( 'vpage', $link );
|
380 |
+
}
|
381 |
+
|
382 |
+
/** Get the page number for Normal pagination
|
383 |
+
*
|
384 |
+
* @return type
|
385 |
+
*/
|
386 |
+
function cv_comp_get_page_number() {
|
387 |
+
$paged = @absint( $_GET[ '_page' ] );
|
388 |
+
if ( !$paged ) {
|
389 |
+
$paged = get_query_var( 'paged' );
|
390 |
+
}
|
391 |
+
if ( !$paged ) {
|
392 |
+
$paged = get_query_var( 'page' );
|
393 |
+
}
|
394 |
+
return $paged;
|
395 |
+
}
|
includes/functions.php
CHANGED
@@ -1254,7 +1254,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
1254 |
$data_page = sprintf( 'data-page="%s"', absint( $this_page ) );
|
1255 |
}
|
1256 |
|
1257 |
-
$html = sprintf( '<a %s href="%s">%s</a>', $data_page,
|
1258 |
$class = $class ? sprintf( 'class="%s"', esc_attr( $class ) ) : '';
|
1259 |
|
1260 |
return sprintf( '<li %s>%s</li>', $class, $html );
|
@@ -1333,7 +1333,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
1333 |
if ( !empty( $pargs[ 'page' ] ) ) {
|
1334 |
$paged = absint( $pargs[ 'page' ] );
|
1335 |
}
|
1336 |
-
$pagenum =
|
1337 |
if ( !empty( $pagenum ) && PT_CV_Functions::setting_value( PT_CV_PREFIX . 'pagination-type' ) === 'normal' ) {
|
1338 |
$paged = absint( $pagenum );
|
1339 |
}
|
1254 |
$data_page = sprintf( 'data-page="%s"', absint( $this_page ) );
|
1255 |
}
|
1256 |
|
1257 |
+
$html = sprintf( '<a %s href="%s">%s</a>', $data_page, cv_comp_get_pagenum_link( $this_page ), $label );
|
1258 |
$class = $class ? sprintf( 'class="%s"', esc_attr( $class ) ) : '';
|
1259 |
|
1260 |
return sprintf( '<li %s>%s</li>', $class, $html );
|
1333 |
if ( !empty( $pargs[ 'page' ] ) ) {
|
1334 |
$paged = absint( $pargs[ 'page' ] );
|
1335 |
}
|
1336 |
+
$pagenum = cv_comp_get_page_number();
|
1337 |
if ( !empty( $pagenum ) && PT_CV_Functions::setting_value( PT_CV_PREFIX . 'pagination-type' ) === 'normal' ) {
|
1338 |
$paged = absint( $pagenum );
|
1339 |
}
|