WordPress post shortcode pagination not working
Question
I’ve created a shortcode for displaying posts from specific category. All works correctly except the pagination. The pagination is displaying correctly and can navigate through pages. But other posts are not showing. Please help me.
<?php
add_shortcode('post', 'recent_posts_function');
function recent_posts_function($atts){extract(shortcode_atts(array('cat' => '','count' => 2,), $atts));
$return_string = '<div class="grid">';
query_posts(array('category_name' => $cat, 'order' => 'DESC' , 'showposts' => $count));
if (have_posts()) : while (have_posts()) : the_post();
$return_string .= '<div class="card"><img class="thumb" src="'.catch_that_image().'"><div><a href="'.get_permalink().'">'.get_the_title().'</a>'.get_the_excerpt().'</div></div>';
endwhile; endif; wp_reset_query();
$return_string .= '</div><div class="pagen">'.paginate_links().';</div>';
return $return_string;
} ?>
0
1 year
2021-11-17T20:59:52-05:00
2021-11-17T20:59:52-05:00 0 Answers
0 views
0
Leave an answer