WordPress.org

Ready to get started?Download WordPress

Forums

orderby => 'title' not working. (1 post)

  1. BillyAtStudioPretty
    Member
    Posted 1 year ago #

    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. ]

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by BillyAtStudioPretty
  • This topic is not resolved
  • WordPress version: 3.5