Add link to the calendar view that only shows events by a specific organizer

Home Forums Calendar Products Events Calendar PRO Add link to the calendar view that only shows events by a specific organizer

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1026055
    Brent Kozlowski
    Participant

    I would like to limit the number of upcoming events to “6” and add a “view more” link under the upcoming events in single-organizer.php that links to the calendar view similar to:

    mysite.com/events/category/my-category/

    but instead only shows events by a specific organizer:

    mysite.com/events/organizer/my-organizer/

    I also know I have to use the “tribe_events_single_organizer_posts_per_page” filter, but have no idea how to add it to my functions file but have no idea how to write it?

    apply_filter( 'tribe_events_single_organizer_posts_per_page', 'limit_upcoming_events' );
    function limit_upcoming_events() {
        apply_filters( 'tribe_events_single_organizer_posts_per_page', 2 );
    }
    
    #1026508
    George
    Participant

    Hey there! Limiting the posts-per-page can not be done with the code you gave as an example, you would need to use this code instead:


    add_filter( 'tribe_events_single_organizer_posts_per_page', 'tribe_support_1026055' );

    function tribe_support_1026055( $count ) {
    return 6;
    }

    Change the 6 to whatever number of posts you want to show up, of course 🙂

    Adding a view more link like you described is a bit more complex but you’ve got the right idea by modifying single-organizer.php.

    Cheers!
    George

    #1026534
    Brent Kozlowski
    Participant

    Thanks!

    Here’s the link code for “View All Events” by a specific organizer on the maps list:

    <a href="http://mysite.com/events/?action=tribe_geosearch&tribe_paged=1&tribe_event_display=map&tribe_organizers%5B%5D=<?php echo $organizer_id; ?>">View All Events by <?php echo tribe_get_organizer( $organizer ) ?></a>

    #1027263
    George
    Participant

    Cool – if that’s what you want to add to your templates via custom code, single-organizer.php is the best file to edit.

    Be sure to use the principles outlined here if you customize, though! → https://theeventscalendar.com/knowledgebase/themers-guide/

    Cheers 🙂
    George

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Add link to the calendar view that only shows events by a specific organizer’ is closed to new replies.