Filtering users via WP_Query
-
Ok, I’m at a complete loss, and I’m fairly sure it’s something straight forward.
I have a template that contains the following, and the list of people in question are members of different groups. (For instance, students in class X, students in class Y). I’d like to modify the code to be able to filter the returned list of people based on group membership. I’ve been trying to find a simple example of how to do this, but alas, no joy. Can anyone point me in the right direction?
Thanks much!
// No direct access if ( ! defined( 'ABSPATH' ) ) exit; // Query events that ended before today function people_loop_after_content() { return new WP_Query( array( 'post_type' => 'ctc_person', 'paged' => ctfw_page_num(), // returns/corrects $paged so pagination works on static front page 'orderby' => 'menu_order', 'order' => 'ASC' ) ); } // Make query available via filter add_filter( 'loop_after_content_query', 'people_loop_after_content' ); // Load main template to show the page locate_template( 'index.php', true );
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Filtering users via WP_Query’ is closed to new replies.