Leave a Reply

1 comment

  1. You should use some of WordPress’s built in functions, there is even a new meta compare parameter. You can create, for example:

    $state =  get_post_meta($post->ID, 'meta_state', true);  //the meta value to compare
    $query = new WP_Query
                  ( array( 
                   'meta_key' => 'project', 
                   'meta_value' => '$state', 
                   'meta_compare' => '<=', 
                   'post_type' => 'projects' ) );
    
    //spit them out into yearly dates using a conditional tag