Yes, it is possible, and I use it on my own site. Here it is in action: my Settings API post is paginated, but can viewed on a single page, using the "Single-Page View" link.
First, you need to prepare a custom query variable, e.g. in functions.php
, add the following:
function cbnet_parameter_queryvars( $qvars ) {
$qvars[] = 'all';
return $qvars;
}
add_filter( 'query_vars', 'cbnet_parameter_queryvars' );
Second, inside the Loop, you need to replace your basic call to the_content()
with the following:
global $wp_query;
$no_pagination = false;
if ( isset( $wp_query->query_vars['all'] ) ) {
$no_pagination = $wp_query->query_vars['all'];
}
if( $no_pagination ) {
echo apply_filters( 'the_content', $post->post_content );
$page=$numpages+1;
} else {
the_content('Read the rest of this entry');
}
Then finally, you need to add a link to generate the single-page view, e.g. next to your "Permalink" and "Comments" links in your Post Meta:
<?php
global $numpages;
if ( is_singular() && $numpages > 1 ) { ?>
<strong>|</strong> <a href="<?php echo add_query_arg( array( 'all' => '1'), get_permalink() ); ?>" title="single-page view">Single-Page View</a>
<?php } ?>
Now, when you clock the "Single-Page View" link, the entire post content will appear on a single page.
Note: h/t to this WPORG support forum topic