Wordpress how can I know if the pagination is active?

php, wordpress, wordpress-theming

Solution

If you look at the new_posts_link function, you'll see a $max_page and $paged vars.

If the $pages is higher to 1, there is a previous page link. It it's smaller to $max_page, there is a next page link.

So you can do the following functions :

# Will return true if there is a next page
function has_next_page() {
    global $paged, $max_page;
    return $paged < $max_page;
}

# Will return true if there is a previous page
function has_previous_page() {
    global $paged;
    return $paged > 1;
}

# Will return true if there is more than one page (either before or after).
function has_pagination() {
    return has_next_page() or has_previous_page();
}

Problem

Has Wordpress a function or something like that?I need a way to check if there are any page links(Older Entries | Newer Entries)to be displayed or not. Best Regards,

Original source