WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is there a way I can retrieve the first and second post in wordpress...

I have tried using get_post() but with that I have to put in a id. What if I don't know the posts id?

share|improve this question
How do you define "first and second"? Earliest by date posted? – Rarst Sep 28 '12 at 14:58

Have you tried using WP_Query()?

$query = new WP_Query( 'posts_per_page=2' );

You can also split it into two quieries if you must, with an offset:

$query = new WP_Query( 'posts_per_page' => 1 ) ); // First post
$query = new WP_Query( 'posts_per_page' => 1, 'offset=1' ) ); // Second post
share|improve this answer

Your Answer


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.