Reputation: 1826
How can I limit query result in wordpress let's say I want to display just 4 last posts from a category but starting from second row, I know that in MySql is like this:
select *
from table_name
limit 4, 1
In wordpress should be something like this:
('cat' => get_category_id($catname), 'posts_per_page' => 2, 1);
But it is not working
Upvotes: 1
Views: 38
Reputation: 1826
I found the solution, i just needed to use the offset variable instead of paged.
Check here for details
http://wordpress.org/support/topic/query_posts-offset-and-pagination
Upvotes: 1
Reputation: 2259
Use the paged
(and the $paged
WordPress variable) argument. All info here : http://codex.wordpress.org/Pagination#Adding_the_.22paged.22_parameter_to_a_query
Upvotes: 2