How Can I sort by Ascending Name in this Statement? (2 posts)

  1. Diesel12
    Posted 6 years ago #

    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!

    $categories = get_the_category($post->ID);
    if ($categories) {
    	$category_ids = array();
    	foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
    		'category__in' => $category_ids,
    		'post__not_in' => array($post->ID),
    		'showposts'=>100, // Number of related posts that will be shown.
    $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()) {
    			<li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    		echo '</ol>';
  2. Diesel12
    Posted 6 years ago #

    Got it working, should have been using "title" instead of "name in 'orderby' ....

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.