Forums

query_posts order not working with ASC (2 posts)

  1. Jazzikins
    Member
    Posted 1 year ago #

    This is really odd to me. I am trying to order my posts by the meta_value in my meta_key communityEventDate. It works great when I choose descending order. But when I choose ascending order (which is what I really need) it only shows 3 posts.

    I'm pretty new to WordPress so I know I must be doing something very wrong here. Here's my code.

    $today = date('m/d/Y');
    
    	query_posts(array(
    		'cat' => 5,
    		'meta_key' => 'communityEventDate',
    		'meta_compare' => '>=' . $today,
    		'orderby' => 'meta_value',
    		'meta_key' => 'communityEventDate',
    		'order' => 'ASC'
    		));
    
            while (have_posts()): the_post();
  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Why do you have 2 instances of 'meta_key' => 'communityEventDate',?

Topic Closed

This topic has been closed to new replies.

About this Topic