Wordpress - How to display the list of post from a category

Discussion in 'WordPress' started by testblanc, Jun 13, 2008.

  1. #1
    Hi,
    this is the code I tried to use (in my nav bar) but it displayed only one post, the last.
    I ask the code to display the last 15 url
    I'm using WP 2.3
    Thanks for your help


    <h2>Shop By Brand</h2>

    <?php $my_query = new WP_Query('category_name=Shop By Brand&showposts=15');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
    <?php endwhile; ?>


    Sorry!
    I find the answer. I just forgot to put <br> after each url
     
    testblanc, Jun 13, 2008 IP
  2. uglyboy

    uglyboy Peon

    Messages:
    1,963
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this..

    <ul>
    <?php
    global $post;
    $myposts = get_posts(’numberposts=XXcategory=XX’);
    foreach($myposts as $post) :
    setup_postdata($post);
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </li>
    <?php endforeach; ?>
    <ul>
     
    uglyboy, Jun 13, 2008 IP
    buffalo likes this.
  3. rilwis

    rilwis Peon

    Messages:
    104
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try to place category name in quote ""
     
    rilwis, Jun 15, 2008 IP