Plugin Author
scribu
(@scribu)
You can pass any additional query vars to WP_Query:
$my_query = new WP_Query( array(
'connected_type' => 'YOUR_CONNECTION_TYPE',
'connected_items' => $YOUR_CLIENT_ID,
'meta_key' => 'YOUR_META_KEY',
'meta_value' => 'YOUR_META_VALUE',
) );
while ( $my_query->have_posts() ) : $my_query->the_posts();
...
And you do that for each column, only changing the meta_value.
Thread Starter
Griffin
(@rgriffinj)
Thanks for the swift response! I had originally tried exactly what you posted, but it wasn’t working. Scanning through my code, however, I found a small typo that was causing the error. It’s working great now.
Thank you!
Thread Starter
Griffin
(@rgriffinj)
Hi!
So this is working great now. I still have one issue, however. ‘Placements’ are now organized into groups based on what ‘Client’ they are associated with, so they are ordered chronologically within groups, and then each group is ordered chronologically with each other. The problem is that I need to order all placements chronologically with one another, independent of what ‘Client’ they are associated with. In other words, I need my loop to output just a list of ‘Placements’, instead of ‘Placements’ grouped by ‘Client’.
Let me know if I need to clarify the question further.
And thank you!
Plugin Author
scribu
(@scribu)
In that case, you don’t need to loop the loop at all.
Just pass all the client ids to the ‘connected_items’ parameter as an array:
$my_query = new WP_Query( array(
'connected_type' => 'YOUR_CONNECTION_TYPE',
'connected_items' => wp_list_pluck( $wp_query->posts, 'ID' ),
) );
while ( $my_query->have_posts() ) : $my_query->the_posts();
(assuming $wp_query->posts contains a list of ‘client’ posts)
Thread Starter
Griffin
(@rgriffinj)
Thank you! I’ll give it a try.
Thread Starter
Griffin
(@rgriffinj)
Worked perfectly. Thank you! This plugin is great and you’ve been extremely responsive. Do you have a donate button somewhere? I’d love to buy you a beer.
Plugin Author
scribu
(@scribu)