Tagged: pagination
-
AuthorPosts
-
June 8, 2016 at 11:24 am #644705
Hi,
i have more then one Archivesites and i need a pagination for every site. I make a shortcode in functions.php for each site. When i open the Site the pagination works, i can change the site. The script see how many post i have and make the right numbers of Sites, but i have at every site the same posts.
i work with this code:
function kriesi_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 “<div class=’pagination’>”;
if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo “«“;
if($paged > 1 && $showitems < $pages) echo “‹“;for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? “<span class=’current’>”.$i.”</span>”:”“.$i.”“;
}
}if ($paged < $pages && $showitems < $pages) echo “›“;
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo “»“;
echo “</div>\n”;
}
}function artikel_zinsimmo() {
ob_start();
?>
<?php $additional_loop = new WP_Query(“cat=45&paged=$paged&showposts=2”); ?>
<?php while ($additional_loop->have_posts()) : $additional_loop->the_post(); ?>
<!– The Post //–>
<?php endwhile; ?>
<?php kriesi_pagination($additional_loop->max_num_pages); ?>
<?php$output = ob_get_clean();
return $output;
}
add_shortcode(‘artikel_zins’, ‘artikel_zinsimmo’);What can i do?
Thanks for your replay.
Andre
- This topic was modified 8 years, 6 months ago by lightdream68.
June 9, 2016 at 11:56 am #645386Hey lightdream68,
Thank you for using Enfold.
Why do you need to do this? There should be a pagination in the archive pages by default. Try to use the avia_pagination function:
echo " <div class='page_nav'>".avia_pagination('', 'nav')."</div> ";
Best regards,
IsmaelJune 9, 2016 at 12:40 pm #645402Hi Ismael,
i have for every category a other Layout, with different content to the artikles.
For this i need a Pagination for all Sites.
Best regards,
André
June 12, 2016 at 4:35 am #646775Hi,
Did you create a new template for the archive page? Did you try the avia_pagination function?
function artikel_zinsimmo() { $output = " <div class='page_nav'>".avia_pagination('', 'nav')."</div> "; echo $output; } add_shortcode('artikel_zins', 'artikel_zinsimmo');
Best regards,
IsmaelJune 15, 2016 at 4:25 pm #648704Hi Ismael,
thanks for your answer. I don’t have a Child-Theme but i try the avia_pagination. But this not work!
I send you the link you can see what i mean.
Best regards
Andre
June 18, 2016 at 3:25 am #650059Hi,
Are you trying to use it on pages created with the advance layout builder? I’m sorry but it’s not going to work with ALB. We would like to help but this modification is outside the scope of support. Please hire a freelance developer or contact codeable: http://kriesi.at/contact
Best regards,
IsmaelJune 19, 2016 at 4:11 pm #650428Hi Ismael,
thanks for your time. I have solved this problem with WP original code.
Best regards
Andre
June 20, 2016 at 8:03 am #650663 -
AuthorPosts
- You must be logged in to reply to this topic.