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.

I am using wordpress as a quick fix for a blog for my site. I am using a short loop in an external page (i got the links to use the wordpress set-up correctly):

query_posts('p='.$thisPost); //$thisPost enumerates 1,2..etc up to a maximum number of posts

<?php 
while (have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>

The issue that in the database the wordpress would store post #2 as "p=6", which essentially screws up this setup.

How would I get a post number 2 ( or 3 or n ) from the start?

share|improve this question

1 Answer 1

The database is not just storing the posts that you have created, it stores revisions of that post along with other post types, etc. all in this table. So the post ids of the posts that we enter rarely go up one at a time.

The post ids themselves are not very relevant in the queries. The specific queries are used to only show posts that have a certain criteria, such as category, post_type, date stored, etc.

share|improve this answer

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.