How Can I sort by Ascending Name in this Statement?
-
I’m trying to sort the output of this statement alphabetically, I’ve used ‘orderby’=>name and ‘order’=>asc with no luck, anyone know the correct way to accomplish this?
Any feedback appreciated!
<?php $categories = get_the_category($post->ID); if ($categories) { $category_ids = array(); foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id; $args=array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'showposts'=>100, // Number of related posts that will be shown. 'orderby'=>name, 'order'=>asc, 'caller_get_posts'=>1 ); $my_query = new wp_query($args); if( $my_query->have_posts() ) { echo '<div id="category_more_resources"> Related Information:</div><ol>'; while ($my_query->have_posts()) { $my_query->the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li> <?php } echo '</ol>'; } } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How Can I sort by Ascending Name in this Statement?’ is closed to new replies.