Google Like Pagination

function pagination($pages = ”, $range = 4)
{
$showitems = ($range * 2)+1;

global $paged;
if(empty($paged)) $paged = 1;

if($pages == ”)
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}

if(1 != $pages)

{
echo “

“;
//if($paged > 2 && $paged > $range+1 && $showitems « First“;
//echo ““;
//if($paged > 1) echo ““;
//if($paged > 1) echo “Previous“;
//echo “
“;
echo ““;
if($paged == 1){
echo ““;
} else {
echo ““;
}
echo “
“;
if($paged == 1){
echo “Previous“;
} else {
echo “Previous“;
}
echo “
“;
for ($i=1; $i = $paged+$range+1 || $i “.$i.”“:”“.$i.”“;

}
}
$current_page = max( 1, get_query_var(‘paged’) );
echo ““;
if($pages == $current_page){
echo ““;
} else {
echo ““;
//echo $current_page;
}
echo “
“;
if($pages == $current_page){
echo “Next“;
} else {
echo “Next“;
}
echo “
“;
//echo ““;
//if ($paged ›“;
//if ($paged Next“;
//echo “
“;
//if ($paged Last »“;
echo “

\n”;
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: