Skip to content
Advertisement

WordPress pagination not working for get_posts() function?

I have make one Template and assign a template to testimonial page. All the below code is placed inside my template file.

My problem is that Nextand Prev links are not even displaying on Testimonial page. I want to use only get_posts query to retrieve data.

How can I display pagination for get_posts?

JavaScript

Advertisement

Answer

Please don’t use get_posts if you need paginated queries.

I think the easiest and most appropriate here is to make use of WP_Query to construct your custom query I do think that next_posts_link() and previous_posts_link() is better to use with WP_Query

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement