WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 'orderby'=>"post_date" not working (4 posts)

  1. icakeov
    Member
    Posted 7 months ago #

    I have just realized that the get_posts function is not displaying the latests posts. It seems to display posts that is a day or two old and then goes back until it reaches the numberposts amount.

    The first batch is displaying featured 4 posts:

    $args = array( 'numberposts' => 4, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date",'order'=> 'DESC','tag'=>"Feature",'category__not_in'=> array(19,27,454));
        					$postslist = get_posts( $args );

    And then this is the part that is not displaying the newest posts (perhaps the above code messes things up?)

    $args = array('offset'=> 4, 'numberposts' => 10, 'post_status'=>"publish",'post_type'=>"post",'order'=> 'DESC','orderby'=>"post_date",'post__not_in'=> $not_duplicate, 'category__not_in'=> array(19,27,454));

    here's the page: http://hushmagazine.ca/
    Thanks!

  2. WPShowCase
    Inactive
    Posted 7 months ago #

    post_date is the name of a column but 'orderby'=>"post_date" should be 'orderby'=>"date".

  3. icakeov
    Member
    Posted 7 months ago #

    Thanks WPShowCase, I replaced it with 'date' yet the issue is still there. There actually is a posting that was published yesterday that's not displaying still.

  4. icakeov
    Member
    Posted 7 months ago #

    Figured it out! It was the offset being 4. I am already keeping track of the featured images through a parameter so it was unnecessary to offset the posts.
    Thanks again for your help WPShowCase

Reply

You must log in to post.

About this Topic