Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How do i specify which "page" to get when using WP_Query? I'm using pagination and i only display three posts per page, but i need to manually set which page to get, because Wordpress doesn't do that by default it seems.

Is there an argument i can send with WP_Query() to get a specific page?

share|improve this question

1 Answer 1

before WP_Query() check page condition is_page('pade_id') if true then execute the wp_query().

share|improve this answer
    
No, sorry, i don't want to specify the page id, i want to specify the current pagination-page. Let's say i'm browsing my blog frontpage which lists 10 posts per page. If i click "next page" at the bottom, it will (should) show me the next 10 posts. That would be "page" 2 of the frontpage. Do you get what i mean? –  qwerty Dec 3 '12 at 9:52
    
In in which file u are using pagination in single.php or page.php ???? Currently what is happening ??? –  Monika Dec 3 '12 at 9:58
    
If u want only 3 post per page then use argument post_per_page=3 in wp_query(). –  Monika Dec 3 '12 at 9:59
    
The loop that gets post is in a file called loop.php, which i just include on my pages where i want to display posts. I know i can use posts_per_page, but that will only limit the post count, it's pretty much the same as using numberposts. I need to get the posts from a different page using an argument. Do you understand? This is kinda hard to explain... –  qwerty Dec 3 '12 at 10:10
    
Either that or an argument that functions as an "offset". So if i use 2 as offset, it will give me X posts starting from 3 (excluding the first two). That would also work. –  qwerty Dec 3 '12 at 10:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.