最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

slideshow - help me about my slide bar

programmeradmin0浏览0评论

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

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

Share Improve this question asked Sep 1, 2013 at 11:52 MajidGhMajidGh 1031 gold badge1 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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'
发布评论

评论列表(0)

  1. 暂无评论