Support » Plugin: Related Posts Thumbnails Plugin for WordPress » How to order posts by their dates???

  • Hi, I want related posts order by date. How to do it?
    I found a code below maybe cause the result:

    /* Get posts by their IDs */
    if ( !is_array( $random_posts ) || count( $random_posts ) < 1 ) {
    return $this->finish_process( $output, $debug . 'No posts matching relationships criteria;', $time );
    		}
    $posts_in = array();
    foreach ($random_posts as $random_post)
    	$posts_in[] = $random_post->ID;
    $query = "SELECT ID, post_content, post_excerpt, post_title FROM $wpdb->posts WHERE ID IN ('". implode( "', '", $posts_in ) . "')";
    $posts = $wpdb->get_results( $query );
    if ( ! ( is_array( $posts ) && count( $posts ) > 0 ) ) { // no posts
    	$debug .= 'No posts found;';
    	return $this->finish_process( $output, $debug, $time );
    }
    else
    	$debug .= 'Found ' . count( $posts ) . ' posts;';

    and I want the current post show up on list, too.
    Thx!

    http://wordpress.org/extend/plugins/related-posts-thumbnails/

  • The topic ‘How to order posts by their dates???’ is closed to new replies.