• damirmerdan

    (@damirmerdan)


    Hi, I have following code:

    <?php
    $my_query = new WP_Query(‘showposts=5&category=featured’);
    while ($my_query->have_posts()) : $my_query->the_post();
    echo ‘<li class=”s3sliderImage”><img src=’; echo catch_that_image(); echo ‘ /><span>’ . the_title(”,”,FALSE) . ‘</span>’;
    endwhile;

    ?>

    I am trying to create featured posts slider, which will view only posts from category “featured”. When I use the code above, it show me some posts from other category’s, even if the category “featured” is empty. So, I’am trying to view only last 5 posts from category “featured”. How can I do this.

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter damirmerdan

    (@damirmerdan)

    Solved ?? :), I need to use category_name=featured insted of categoty=fatured !

Viewing 1 replies (of 1 total)
  • The topic ‘How to use WP_Query() to view just certain posts’ is closed to new replies.