help me about my slide bar

i my website them has a sildeshow in this slideshow show 5 newsest post! i need chane newpost to a Specific catagory for exp news catagory? my slideshow code is:

    div class="callbacks_container"
  ul class="rslides" id="slider3"
    ?php
$the_query = new WP_Query(array('order' ='descending','orderby' ='ID','posts_per_page' ='5'));   
while ($the_query-have_posts()) : $the_query-the_post(); ?
    li
      ?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('large');
}
else {
echo 'img alt="No Image" src="' . get_stylesheet_directory_uri() . '/images/no-image.png" /';
}
?
      p class="caption"
        ?php the_title(); ?
      /p
    /li
    ?php endwhile; ?
    ?php wp_reset_query(); ?
  /ul
/div

plz help me soon!

tnx alot

Topic slideshow Wordpress

Category Web


As far as i understand your question is that you want to get posts from specific category.

    <div class="callbacks_container">
  <ul class="rslides" id="slider3">
    <?php
$the_query = new WP_Query(array('order' =>'descending','orderby' =>'ID','posts_per_page' =>'5', 'category_name' => 'news'));
while ($the_query->have_posts()) : $the_query->the_post(); ?>
    <li>
      <?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('large');
}
else {
echo '<img alt="No Image" src="' . get_stylesheet_directory_uri() . '/images/no-image.png" />';
}
?>
      <p class="caption">
        <?php the_title(); ?>
      </p>
    </li>
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
  </ul>
</div>

Add category_name to the $the_query array and give the value of your category slug.

Like this:

'category_name' => 'news'

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.