Testing for paginated Pages
-
I found these two examples:
“You can use this code to check whether you’re on the nth page in a Post or PAGE Page that has been divided into pages using the <!–nextpage–> QuickTag. This can be useful, for example, if you wish to display meta-data only on the first page of a post divided into several pages.”
<?php $paged = $wp_query->get( 'paged' ); if ( ! $paged || $paged < 2 ) { // This is not a paginated page (or it's simply the first page of a paginated page/post) } else { // This is a paginated page. } ?>
<?php $paged = get_query_var( 'page' ) ? get_query_var( 'page' ) : false; if ( $paged === false ) { // This is not a paginated page (or it's simply the first page of a paginated page/post) } else { // This is a paginated page. } ?>
Neither seem to detect whether or not there is another page or not–on the first page.
What we’ve been trying to get at, is a way to show or hide a div container depending on if there is paginated Pages for the post.
So; if isset($paged){
<div></div>
}Is what I was hoping just might work.
We appreciate any help, thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Testing for paginated Pages’ is closed to new replies.