How to Display More than Three Related Events

Home Forums Calendar Products Events Calendar PRO How to Display More than Three Related Events

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1124745
    Bobby Kreiner
    Participant

    Some of our events, such as conferences, will have several related social events, such as dinners and golfing events. I have four events that have the same tags and only three of them display as related events. How can I display more than three related events?

    #1124803
    George
    Participant

    Hey @Bobbby,

    Thanks for reaching out. You can alter the number of “related events” shown by adding a snippet like this to your theme’s functions.php file:


    add_filter( 'tribe_related_posts_args', 'tribe_change_number_of_related_events' );

    function tribe_change_number_of_related_events( $args ) {
    $args['posts_per_page'] = 4; // Change this to whatever number you'd like.
    return $args;
    }

    ☝️ Now, please note that this code will only change the number of events shown. The design handles only three by default, so you may need to write custom CSS and such to make your design handle displaying four events well (or whatever other amount).

    We cannot help with custom coding, so for design refinement after you make this change you will have to take the reins on that. To make writing custom CSS on your site easier, if need be, definitely check out a [free!] tool like Firebug if you use FireFox, or the Developer Tools for either Safari or Chrome. They have “Inspector” tools that let you zoom right over the element whose styles you want to adjust, so that you can more easily adjust them to make things look sharp.

    I hope this all helps!

    Cheers,
    George

    #1125063
    Bobby Kreiner
    Participant

    That works perfectly, thank you!

    For the design, adding this CSS makes the events flow neatly in rows of three:

    .tribe-events-single ul.tribe-related-events > li {
    width: 29%;
    }

    #1125077
    George
    Participant

    Glad to hear it!

    I’ll close up this thread for now, but come back and open a new thread any time if other issues/questions ever arise.

    Cheers,
    George

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘How to Display More than Three Related Events’ is closed to new replies.