Custom loop request based on custom field

See WP_Query in Codex for info on how to query on custom fields. $args = array( ‘posts_per_page’ => -1, ‘cat’ => 4, ‘meta_key’ => ‘point_score’, ‘orderby’ => ‘meta_value_num’ ); $points_query = new WP_Query( $args ); while( $points_query->have_posts() ): $points_query->the_post(); the_title(); echo ‘ : ‘; echo get_post_meta( $post->ID, ‘point_score’, true ); endwhile;

Getting selection of posts based on loop variables via Ajax

You can easily add whatever variables you want to your AJAX call. Using jQuery you can set a AJAX action like this: jQuery.post( ‘your-url-to-admin-ajax.php’, { action: ‘your_called_function’, argument: ‘year’ or ‘category’, some_other_var: ‘some value’ }, function( response ) { if(response) { } else { } } ); Then in your functions.php add this: add_action( ‘wp_ajax_nopriv_your_called_function’, … Read more