Skip to content
Advertisement

Custom WP_Query ‘posts_per_page’ is not working

I’m having trouble with multiple posts showing when I’ve declared ‘posts_per_page’.

During my research my code has developed but with still no results. I’ve tried

'ignore_sticky_posts' => 1, 'nopaging' => true (pagination)

switching theme and deactivating plugins. I can’t seem to find the issue. Any help would be much appreciated. Here is the current result – alderneyfootball.co.uk

I have two loops on the page and it’s a custom page template. I’m using the WP-Club-Manager Plugin

JavaScript

Advertisement

Answer

If the two loops data is overwridden then, i your first code wp_reset_query() is incorrect. If you are using WP_Query then

JavaScript

should be used after the end of the WHILE loop which means that in your two loops you have to have

JavaScript

at both loops in the end of the while loop.

Now you codes looks like this:

JavaScript

Hope this works for you

Thank You

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