Show Category and Posts with loop will NOT Order by newest category
-
This code does everything I need it to do except list the categories and posts in reverse. It is listing old to new instead of new to old.
<?php $catQuery = $wpdb->get_results(" SELECT * FROM $wpdb->terms AS wterms INNER JOIN $wpdb->term_taxonomy AS wtaxonomy ON ( wterms.term_id = wtaxonomy.term_id ) WHERE wtaxonomy.taxonomy = 'category' AND wtaxonomy.parent = 0 AND wtaxonomy.count > 0"); $catCounter = 0; foreach ($catQuery as $category) { //latest posts $catCounter++; $catStyle = ''; if (is_int($catCounter / 2)) $catStyle = ' class="catAlt"'; echo '<TR HEIGHT="20" VALIGN="BOTTOM"> <TD COLSPAN="2"><SPAN CLASS="style10"> <div id="Category_format" style"text-align:center; font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #666666; line-height: 13px; font-weight: bold;"> '.$category->name.' </div></TD></TR>'; query_posts('cat='.$category->term_id.'&showposts=99&orderby=category&order=desc'); //this controls the order of the posts with in categories ?> <?php while (have_posts()) : the_post(); ?> <tr><td align="right"><?php the_title(); ?></td><td align="left" style="line-height:50%;"> <span class="links"><?php the_content(); ?></span></td></tr> <?php endwhile; ?> <?php } ?>
`
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Show Category and Posts with loop will NOT Order by newest category’ is closed to new replies.