The is_paged() WordPress PHP function determines whether the query is for a paged result and not for the first page.
Usage
if ( is_paged() ) { // Your custom code here }
Parameters
- None
More information
See WordPress Developer Resources: is_paged()
Examples
Display a message on paged results
This code snippet will display a message only on paged results.
if ( is_paged() ) { echo '**You are viewing paged results.**'; }
Display navigation on paged results
This code snippet will display a navigation menu only on paged results.
if ( is_paged() ) { previous_posts_link('**Previous Page**'); next_posts_link('**Next Page**'); }
Customize post layout on paged results
This code snippet will apply a different post layout for paged results.
if ( is_paged() ) { get_template_part('content', 'paged'); } else { get_template_part('content', 'single'); }
Modify the loop for paged results
This code snippet will modify the loop to display a different number of posts per page for paged results.
if ( is_paged() ) { $args = array( 'posts_per_page' => 5, ); query_posts($args); }
Display an advertisement on paged results
This code snippet will display an advertisement only on paged results.
if ( is_paged() ) { echo '**Ad: Your ad content here.**'; }