wordpressblog-post

Multiple specific POST in wordpress


So i have come with a problem in word press. I want to display specific post in word press, but i dont know how to do it, or don't have the logic. This code i use works great.

<div id="1">
// retrieve one post with an ID of 1
query_posts('p=1');

global $more;
$more = 0;
// the Loop
while (have_posts()) : the_post();
// the content of the post
the_content();
endwhile;
?>
</div>

Good! now i want it to display like this, can't seem to find the logic how to do this

<div id="1">
// POST 1 here
</div>

<div id="2">
// POST 2 Here
</div>

<div id="3">
// POST 3 Here
</div>

Thank you


Solution

  • Here you go. :) I've modified the query_posts call to order by the ID and to order it in ascending order (eg: 1, 2, 3, 5, 29, 199 etc).

    <?php
      // retrieve one post with an ID of 1
      query_posts('orderby=ID&order=ASC');
    
      global $more;
      $more = 0;
      // the Loop
      while (have_posts()) : the_post(); 
        ?>
          <div id="<?=get_the_ID()?>"><?=get_the_content()?></div>
        <?php
      endwhile;
    ?>