Home › Forums › Calendar Products › Events Calendar PRO › Venue/Organizer Shortcodes plugin output filtering
- This topic has 4 replies, 3 voices, and was last updated 10 years, 1 month ago by
Support Droid.
-
AuthorPosts
-
February 26, 2016 at 11:48 pm #1082843
Shannon
ParticipantI am using a plugin called “The Events Calendar: Venue/Organizer Shortcodes” but the shortcodes only give an unsorted list. I was going to try and modify it for my means by alphabetizing the list and only showing active on the calendar venues and organizers, but I cant seem to figure out how.
I have made a copy of the plugin to modify, and tried many things. It seems like it would be easy enough to put a sort() and active-only filter in the query function, but it escapes me.
If you could help me with this small feature request, I would be grateful.
February 27, 2016 at 10:16 am #1082936Brian
MemberHi,
Thanks for using our plugins. I can help out here.
What about under this line:
'post_type' => $this->atts['post_type'],Adding this:
'orderby' => 'title',If you are looking for other orderby parameters WordPress has these:
https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
Let me know if that helps.
Thanks
February 27, 2016 at 10:52 am #1082947Shannon
ParticipantThat is brilliant Brian, thank you very much! I also added
'order'=> 'ASC',to have it sort the right way. So now my block looks like this:
$args = array( 'post_type' => $this->atts['post_type'], 'orderby' => 'title', 'order' => 'ASC', 'posts_per_page' => $this->atts['limit'] );Now I just need to limit the output to Venues/Organizers who have upcoming events. Maybe in the “__construct( $atts )” function?
Thank you again for your help!
February 29, 2016 at 7:41 am #1083324Brian
MemberGlad it helps.
There is not function we have to detect if a venue or organizer has events, but you could modify some coding to check after it has been queried.
We use this:
$args = array(
'venue' => $post_id,
'eventDisplay' => 'list',
'posts_per_page' => -1,
);$html = tribe_include_view_list( $args );
$args = array(
'organizer' => $post_id,
'eventDisplay' => 'list',
'posts_per_page' => -1,
);$html = tribe_include_view_list( $args );
You could check if that html includes events or not and then display the name based on that result.
I think you could use tribe_get_events instead of tribe_include_view_list and that might return nothing then if there are no events.
Cheers
March 15, 2016 at 9:35 am #1089155Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Venue/Organizer Shortcodes plugin output filtering’ is closed to new replies.
