Home › Forums › Calendar Products › Events Calendar PRO › Exclude Events Tags From Related Events Output
- This topic has 5 replies, 2 voices, and was last updated 11 years ago by
Josh.
-
AuthorPosts
-
June 17, 2015 at 8:05 pm #970830
Christopher
ParticipantHi there,
I need my related events output to show events with the same categories only. I would like to exclude the event tags from this output on the event pages.
I searched far and wide for a solutions but came up with nothing. Unfortunately, all my events currently in the system have the same tag, which is “2015/16 Season.
I believe thats why I am seeing the same related events on every event posts. This is not desirable.
Can you please provide me with the code to exclude Event Tags on the Related Events Output?
Thank,
ChrisJune 18, 2015 at 1:02 pm #971061Josh
ParticipantHey Chris,
Thanks for reaching out to us!
The related events on the event template are built using the “tribe_get_related_posts()” function. Within this function is also the ability to filter the output using a filter of the same name (tribe_get_related_posts). Looking at the source file for direction, you could use this filter to remove the tags from the array and return just posts related by category.
Let me know if this helps.
Thanks!
June 20, 2015 at 10:37 am #971644Christopher
ParticipantHi Josh,
Thanks, yes that helped me. I removed the code below from this file:
events-calendar-pro/public/template-tags/general.php
if ( $tags ) {
$args[‘tax_query’][] = array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘id’, ‘terms’ => $tags );
}
It did the trick, but this is not ideal because I’m not doing an override here. I’ve edited the file directly.
I guess my next question is there a way to override this file? I couldn’t find an answer to this in your documentation.
Thanks,
ChrisJune 24, 2015 at 12:50 pm #972698Josh
ParticipantHey Chris,
No problem, try adding the following to your theme’s functions.php file https://gist.github.com/BeardedGinger/329f48f285fb6183b94f to filter out the inclusion of tags from the query without having to modify the core plugin files.
Let me know if this helps.
Thanks!
July 7, 2015 at 7:43 am #984435Christopher
ParticipantHi Josh,
Thanks, yes this is exactly what I needed!
Cheers,
ChrisJuly 7, 2015 at 10:17 am #984514Josh
ParticipantHey Christopher,
Awesome! Happy to help.
I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new thread.
Thanks!
-
AuthorPosts
- The topic ‘Exclude Events Tags From Related Events Output’ is closed to new replies.
