Venue/Organizer Shortcodes plugin output filtering

Home Forums Calendar Products Events Calendar PRO Venue/Organizer Shortcodes plugin output filtering

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1082843
    Shannon
    Participant

    I 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.

    #1082936
    Brian
    Member

    Hi,

    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

    #1082947
    Shannon
    Participant

    That 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!

    #1083324
    Brian
    Member

    Glad 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

    #1089155
    Support Droid
    Keymaster

    This 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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Venue/Organizer Shortcodes plugin output filtering’ is closed to new replies.