Related events cache conflict?

Home Forums Calendar Products Events Calendar PRO Related events cache conflict?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #939116
    leviticus
    Participant

    I turned on related events and it seems to only grab 3 specific events no matter what single event I’m on.

    I have WP Super Cache installed, but even with it turned off, it still grabs the same ones.

    I have my categories divided up between three main categories and many sub-categories. Would that be causing an issue? Is there a way to have the related events target/prefer the sub-categories? Or is there another way to strengthen the relationship between certain events?

    #939380
    Barry
    Member

    Hi leviticus,

    The relationship is based on having shared categories and tags and the result set should indeed be ordered randomly — but of course how random it will appear in practice does rather depend on the number of events you have available that have a relationship with the source event.

    If you want to tweak the query used to build the list of related events you can do so quite safely via the tribe_related_posts_args filter (a working knowledge of the arguments used when forming a WP_Query would be useful here 🙂 ).

    Alternatively, you could use the tribe_get_related_posts hook to substitute your own array of event posts and could build that list anyway you like.

    Additionally, if you aren’t happy with the above approaches, you could override the pro/related-events.php template and build a custom solution in there.

    Last but not least, if you feel there’s a good case for modifying the way this feature works out of the box in a future release (or if you want to see more options to help control it) we’re all ears – please don’t hesitate to post one or more feature requests over on our UserVoice page.

    Thanks – and I hope that helps 🙂

    #939386
    Barry
    Member

    … I’m going to eat my own words here. Looks like the random ordering is overridden by a different system within the plugin.

    The following snippet – which you could add to your theme’s functions.php file, for example – should ensure randomness is maintained so you could give it a try:

    add_filter( 'tribe_related_posts_args', 'ensure_random_related_event_ordering' );
    
    function ensure_random_related_event_ordering( $args ) {
    	add_filter( 'tribe_events_query_posts_orderby', 'restore_random_ordering' );
    	return $args;
    }
    
    function restore_random_ordering() {
    	remove_filter( 'tribe_events_query_posts_orderby', 'restore_random_ordering' );
    	return 'RAND()';
    }

    That aside, again the level of appararent randomness will still depend on the total number of related events available. I hope that works for you!

    #940339
    leviticus
    Participant

    Thanks Barry. The functions you provided seem to have added more variety in the generated related events.

    If I wanted to tweak the tribe_related_posts_args filter or tribe_get_related_posts hook, where would I find/edit/add that?

    #940351
    Barry
    Member

    Glad it helped 🙂

    If I wanted to tweak the tribe_related_posts_args filter or tribe_get_related_posts hook, where would I find/edit/add that?

    The snippet I just provided is a good example of working with the tribe_related_posts_args filter and you’d basically follow a similar process with the tribe_get_related_posts hook: the key difference is that the first of those gives you an opportunity to modify the query arguments, the second gives you a chance to modify/add to/replace the actual list of posts that is generated.

    Does that clarify things?

    #950425
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

    #965790
    Leah
    Member

    Hi there,

    Thanks again for your post. We wanted to get in touch and let you know that although we weren’t able to address this issue in our upcoming 3.10 release, it is still very much a priority. We have a ticket in our system and will be investigating a solution to be released in a future version. Thank you for your patience and support while we work on this!

    Cheers,
    The Events Calendar Team

    #988036
    Leah
    Member

    Hello,

    Thank you again for bringing this issue to our attention. We’re happy to say that we have added a fix for this into our upcoming version 3.11 release. Keep an eye on your Updates page for the new version. If you have any trouble with the update (or are still seeing this problem after you update) please start a new thread and we’d be happy to help out.

    Thank you for your patience while we got this release ready to go!

    Best,
    Leah
    and the rest of The Events Calendar team

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Related events cache conflict?’ is closed to new replies.