Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Display posts from category in descending date order WordPress

  • SOLVED

This is what my code looks like now:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>

<div class="blog-cont">
<h3><?php the_title(); ?></h3>
<div class="entry">
<!-- entry-->
<p>
Posted on <?php the_time("F, d, Y"); ?> by <a href="#"><?php the_author(); ?> - </a>

‪<a href="<?php the_permalink() ?>#comments"><span><?php comments_number('0','1','%')?> Comments</span></a>‬
</p>
</div>
<div class="box-blog">
<!-- box blog-->
<div class="img-box">
<?php the_post_thumbnail('medium'); ?>
</div>
<div class="text-box-blog">
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" class="btn"><span>Continue reading &#187;</span></a>
</div>
</div>

</div>
<?php endwhile; endif; ?>

Answers (1)

2011-06-07

Kailey Lampert answers:

Put this before the code that you have now.

$cat_id = CATEGORY_ID; //replace with actual category ID :)
query_posts("cat=$cat_id&orderby=date&order=DESC");


Louis Gubitosi comments:

Sorry, I don't have a category ID. This is dynamic for all categories.


Kailey Lampert comments:

In that case, you should be able to use this
$cat_id= get_queried_object_id();
query_posts("cat=$cat_id&orderby=date&order=DESC");