Tiny code problem, please help!

Discussion in 'Programming' started by relatedr, Apr 17, 2009.

  1. #1
    Hello.

    I'm changing a wordpress theme and I'm almost all done but I have a small problem I can't figure out. I'm going to post the code below;
    
    <div id="rec" class="hiddencontent">
    <?php $my_query = "showposts=10"; $my_query = new WP_Query($my_query); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <h5>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h5>
    <p><?php the_time('F j, Y') ?>
    <?php the_category(', ') ?></p>
    <?php endwhile; ?>
    </div>
    
    Code (markup):
    The code above is for a small tabber I have on the right side and at the moment it showes the 10 recent posts put on the blog from all categories but I would like it to only show the 10 recent posts from a certain/indvidual category.

    I named the category "A lausu" and the url name is "alausu"

    Is there any chance someone could help me out with my small problem

    Thanks in advance, best regards
     
    relatedr, Apr 17, 2009 IP
  2. Aaron111

    Aaron111 Well-Known Member

    Messages:
    4,301
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    185
    #2
    have you found anyone yet?/ let me know lol I have simular probs
     
    Aaron111, Apr 17, 2009 IP
  3. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This may not work because of a bug in WP2.7

    <?php $my_query = "showposts=10&category_name=A lausu"; $my_query = new WP_Query($my_query); ?>

    Better to use the category ID number if you can.

    <?php $my_query = "showposts=10&cat=ID"; $my_query = new WP_Query($my_query); ?>
     
    Cash Nebula, Apr 18, 2009 IP
  4. Aaron111

    Aaron111 Well-Known Member

    Messages:
    4,301
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    185
    #4
    I agree the new 2.7.1 is awesome no bugs
     
    Aaron111, Apr 19, 2009 IP