WordPress.org

Support

Support » How-To and Troubleshooting » Group by Month from custom date field

Group by Month from custom date field

  • Is it possible to group this query of classes by month, using the month name as a subhead?

    $args=array(
      'category__and' => array(21,25),
      'post_type' => 'classes',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1,
    'meta_key'=> StartDate,
    'orderby'=>meta_value,
    'order'=> ASC
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts()

    The month name would be coming from the StartDate field. I’d like display these classes like:

    JANUARY
    Class 1
    Class 2

    FEBRUARY
    Class 3
    Class 4

    etc. Thanks for any advice.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Group by Month from custom date field’ is closed to new replies.