WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Listed categories will not order categories by ascending (ASC) (2 posts)

  1. Snazburger
    Member
    Posted 4 years ago #

    I can't get the categories to list by new to old. I've already posted this, but for some reason, I can't edit it to make changes.

    If I change the 'order' to equal ascending it will not take effect at all...
    query_posts('cat='.$category->term_id.'&showposts=0&orderby=name&order=desc');

    Here is the full code:

    <?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 }  ?>
  2. MichaelH
    Member
    Posted 4 years ago #

    Duplicate--continue discussion here:
    http://wordpress.org/support/topic/369731

    Please refrain from posting duplicate topics. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic