• Hi, I’m having a problem ordering some posts in a navigation list. here is my code:

    <ul class="tree lvl-0">
    			<?php
    				$args = array('child_of' => 6);
    				$categories = get_categories( $args );
    				foreach($categories as $category) {
    					echo '<li class="collapsed"><a href="' . get_category_link( $category->term_id ) . '"' . $category->name  . '" ' . '>' . $category->name.'</a>';
    					$cat_id= $category->term_id;
    					wp_reset_query();
    					$args = array(
    						'cat' => $cat_id,
    						'posts_per_page' => 20,
    						'order' => 'ASC',
    						'orderby' => 'title'
    					);
    					query_posts($args);
                        			// start the wordpress loop!
                       			?>
                        			<ul class="lvl-1">
                        				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
     							<li><a href="<?php the_permalink();?>"><?php the_title(); ?></a></li>
                           				<?php endwhile; endif; ?>
                        			</ul>
                      			</li>
    				<?php wp_reset_query(); } ?>
    		</ul>

    Im not too sure what order they are in, It might be date.
    Also, when I order by ‘name’ or anything else, it works. 🙁

    Thanks for any help in advance

    [ Please do not bump, that’s not permitted here. ]

  • The topic ‘orderby => 'title' not working.’ is closed to new replies.