Yes you can use pagination=”yes” attribute for pagination.
Example: [show_posts_pbs_rk layout="1" no_of_post="6" pagination="yes"]
in the above shortcode number of post is set to 6 and pagination is set to yes. So if number of post will greater than 6 then pagination will appear.
Hi Rounak,
that’s what I mean. its not working and I don’t know why.
That’s the shortcode:
[show_posts_pbs_rk layout="6" hide_category="yes" category_id="55" read_more_lebel="MEHR …" no_of_post="2" pagination="yes"]
That’s the page:
https://queer-hannover.de/beitraege
There are 4 posts, so there should be the paging, right?
Okay, pagination will not work if category_id attribute in shortcode.
If you want to use pagination then you have to remove category_id attribute from shortcode.
Currently pagination will work with all attribute except category_id.
Thank you.
Ok that`s sad. Are planing to change it? Might it be possible?
I have created a quick code for you.
You can paste this code above return $content; in posts-by-shortcode-rk.php file.
/* Show Pagination for category attribute */
if($pagination_attr == 'yes' && $category_id != 0){
$args = array(
'cat' => $category_id,
'post_type' => 'post'
);
$the_query = new WP_Query( $args );
$total_posts = $the_query->found_posts;
$total_page = ceil($total_posts/$post_per_page);
if($total_posts > $post_per_page){
$content .= '<div class="pbs_rk_pagination">';
$content .= '<ul>';
for($count = 1;$count<=$total_page;$count++){
if($_GET['offset'] == $count || (empty($_GET['offset']) && $count == 1)){
$content .='<li class="active"><a href="?offset='.$count.'">'.$count.'</a></li>';
}else{
$content .='<li class=""><a href="?offset='.$count.'">'.$count.'</a></li>';
}
}
$content .= '</ul>';
$content .= '</div>';
}
}
I hope it will help.
Thank you so much for your afford and helping!
Sadly its not working. I will get this Error message:
Parse error: syntax error, unexpected ‘&’ in /homepages/34/d389907052/htdocs/clickandbuilds/Queer/wp-content/plugins/posts-by-shortcode/posts-by-shortcode-rk.php on line 183
I have added new version of plugin and added functionality of pagination to category_id attribute.
I have added more attribute to shortcode for more control. you can use them now.