views:

121

answers:

2

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,

+2  A: 

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();
}
Damien MATHIEU
And if it's none of them?I need somthing like this: if($verfication !== false){ //show pagination div....
Uffo
Well if it's none of them, you're on the first page and there isn't any pagination to display. If you want a function that'll give you true or false, you can code it with those two vars.
Damien MATHIEU
A: 

Although like many i use the pagenavi plugin by Lester Chan.right http://lesterchan.net/wordpress/readme/wp-pagenavi.html

crosenblum