On my site, I want some users to see content in Pagination Views but others to see it as a Single Page article.
I followed the steps posted here:
Single Page View for Paginated Posts
What I want is that users from certain traffic sources to see Pagination Views and for others to see Single Page view.
When logged into WordPress, the following code seems to work. When logged out, I’m seeing Single Page View for all users. Here’s the code:
Functions.php Code:
function cbnet_parameter_queryvars( $qvars ) {
$qvars[] = 'utm_source';
return $qvars;
}
add_filter( 'query_vars', 'cbnet_parameter_queryvars' );
Single.php Code:
global $wp_query;
$no_pagination = false;
if(isset( $wp_query->query_vars['utm_source'])) {
$no_pagination = $wp_query->query_vars['utm_source'];
}
if( $no_pagination ) {
the_content();
wp_link_pages(array('next_or_number'=>'next', 'before'=>'<div id="link-pages"><center>', 'after'=>'</center></div>', 'previouspagelink' => ' < PREVIOUS ', 'nextpagelink'=>' NEXT >'));
} else {
echo apply_filters( 'the_content', $post->post_content );
$page=$numpages+1;
}
Thanks