• I’m using a widget that shows the categories and posts on the sidebar as a menu.

    The problem is that i need a reversed order (older posts first).

    This is the part of the code that responsible of getting/displaying the posts:

    // Get array of post info.
    	$cat_posts = get_posts('numberposts='.$num.'&category='.$cat_id);
    
    	echo $before_widget;
    	echo $before_title;
    
    	if( $title_link ) {
    		echo '<a href="' . get_category_link($cat_id) . '">' . $title . '</a>';
    	} else {
    		echo $title;
    	}
    
    	echo $after_title;
    	echo '<ul>';
    	foreach($cat_posts as $post) {
    		setup_postdata($post);
    		echo '<li class="cat-posts-item-' . $post->ID . '"><a href="' . get_permalink($post) . '">' . $post->post_title . '</a>';
    		if( $excerpt ) {
    			echo '<br />';
    			if ($post->post_excerpt!=NULL)
    				echo $post->post_excerpt;
    			else
    				the_excerpt();
    		}
    		echo '</li>';
    	}
    	echo '</ul>';
    	echo $after_widget;

    How can i reverse the order ?

    Thanks,
    E-A.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_post order’ is closed to new replies.