-
Posted in : Responsy WP
-
Hi!
Its posible to add a pagination to portfolio page. See http://www.plafo.com/new/?page_id=55
I have a lot of projects.Thanks
Isma
ok! Please let me know when you finish that.
Thanks
Isma
Hi
have you finished the pagination in the portfolio?Gino
Not yet, but I will have that in mind for a next update.
I have already solved
In function.php add this function
”
function my_pagination($pages = ”, $range = 2)
{
$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 < $pages) echo "<<“;
if($paged > 1){echo “<“;}else{echo “<“;}for ($i=1; $i = $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? "“.$i.”“:”“.$i.”“;
}
}if ($paged < $pages){echo ">“;}else{echo “>“;}
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo ">>“;
echo “\n”;
}
}”Then in file portfolio.php change this at line 102
“$args_portfolio = array( ‘post_type’ => ‘portfolio’, ‘posts_per_page’ => -1 );”
in
“$args_portfolio = array( ‘post_type’ => ‘portfolio’, ‘posts_per_page’ => 9, ‘paged’ => $paged );”
9 = number of item that you would show per page
and add this line
“my_pagination($loop_portfolio->max_num_pages);”
where do you want to appear the paginationBye
The forum ‘Responsy WP’ is closed to new topics and replies.