Title: Problems displaying posts!
Last modified: August 19, 2016

---

# Problems displaying posts!

 *  Resolved [evilpixy](https://wordpress.org/support/users/evilpixy/)
 * (@evilpixy)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/problems-displaying-posts-1/)
 * Hi,
 * I’m having some trouble displaying the post correctly from a certain category.
   
   The code I use:
 *     ```
       <?php query_posts('cat=1&showposts=15'); ?>
       <?php while (have_posts()) : the_post(); ?>
       <?php endwhile;?>
       ```
   
 * Ok – it shows the text/images of the 15 last posts from the category, but fail
   to give the title and/or date.
 * Is there a simple/advance way to get it displayed like:
 *     ```
       <div>
       <strong>[TITLE]</strong><small>[date]</small>
       [Content of the post]
       </div>
       ```
   
 * Thanks in advance,
    EvilPixy

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/problems-displaying-posts-1/#post-1359689)
 * One example you can draw on:
 *     ```
       <?php the_time('m.d.y') ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
       ```
   
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/problems-displaying-posts-1/#post-1359691)
 * You need to add **something** between `<?php while (have_posts()) : the_post();?
   >` and `<?php endwhile;?>` – eg:
 *     ```
       <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
       <?php the_content('Read the rest of this entry &raquo;'); ?>
       ```
   
 * etc.
 *  Thread Starter [evilpixy](https://wordpress.org/support/users/evilpixy/)
 * (@evilpixy)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/problems-displaying-posts-1/#post-1359751)
 * Ok, that works – but the problem is that it shows it all 2 times ?!?
    First –
   within the same sheet and then seperately like it was before.
 * What am I doning wrong here.
    Could it be my code above that is interfering with
   the code? I will post it here for you to see.
 *     ```
       <ul>
       <div style="float:left; width:200px; margin-right:10px;">
       <?php $count=0;
        global $post;
        $myposts = get_posts('numberposts=15&cat=1');
        foreach($myposts as $post) :
          setup_postdata($post); $count++;
        ?>
           <a href="<?php the_permalink(); ?>"><? echo $count?>. <?php the_title(); ?></a>
       	<?php if($count%5 == 0) { echo '</div><div style="float:left; width:200px; margin-right:10px;">'; } ?>
        <?php endforeach; ?>
        </div>
       </ul>
       <div>
       <?php query_posts('cat=1&showposts=15'); ?>
       <?php while (have_posts()) : the_post(); ?>
       <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
       <?php the_content('Read the rest of this entry &raquo;'); ?>
       <?php endwhile;?>
       </div>
       ```
   
 * I hope you can figure this out cause I’m starting to loose it over here.
 * Kind regards,
    EvilPixy
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/problems-displaying-posts-1/#post-1359756)
 * > the problem is that it shows it all 2 times
 * Because you **asked** for the same 15 posts in each Loop.
 * `$myposts = get_posts('numberposts=15&cat=1');`
    […] `<?php query_posts('cat=
   1&showposts=15'); ?>`
 * What is it that you’re trying to do?
 *  Thread Starter [evilpixy](https://wordpress.org/support/users/evilpixy/)
 * (@evilpixy)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/problems-displaying-posts-1/#post-1359780)
 * Both yes and no.
 * Ok – I’m sorry if I’m beeing cryptic.
    The layout of my page is this. First show
   links with text to the 15 first posts in category 1. They will be distributed
   in 3 columns. Then the idea is to display the 15 first posts in category 1 below
   my three columns.
 * I just chose to display 15, but it might aswell be 10 or something.
 * With my current code (2 posts above) it shows the links with text – then one 
   page with a summary of the posts – and then 15 separate “sheets” (everyone with
   only the text from the posts)
 * By only having the code:
 *     ```
       <?php query_posts('cat=1&showposts=15'); ?>
       <?php while (have_posts()) : the_post(); ?>
       <?php endwhile;?>
       ```
   
 * on the page it will show the 15 separate “sheets” with no Title.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/problems-displaying-posts-1/#post-1359835)
 * Try adding `<php wp_reset_query();?>` just before`<?php query_posts('cat=1&showposts
   =15'); ?>`.
 * [http://codex.wordpress.org/Function_Reference/wp_reset_query](http://codex.wordpress.org/Function_Reference/wp_reset_query)
 *  Thread Starter [evilpixy](https://wordpress.org/support/users/evilpixy/)
 * (@evilpixy)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/problems-displaying-posts-1/#post-1359936)
 * Thanks – that did the trick!
 * Kind regards,
    EvilPixy

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Problems displaying posts!’ is closed to new replies.

## Tags

 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [evilpixy](https://wordpress.org/support/users/evilpixy/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/problems-displaying-posts-1/#post-1359936)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
