{"id":1896728,"date":"2019-10-18T13:19:59","date_gmt":"2019-10-18T17:19:59","guid":{"rendered":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/using-venues-for-related-events\/"},"modified":"2020-03-25T08:43:49","modified_gmt":"2020-03-25T12:43:49","slug":"using-venues-for-related-events","status":"publish","type":"post","link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/using-venues-for-related-events\/","title":{"rendered":"Show Related Events at the Same Venue"},"content":{"rendered":"\n<p>The Related Events feature of <a rel=\"noopener noreferrer\" href=\"https:\/\/theeventscalendar.com\/product\/wordpress-events-calendar-pro\/\" target=\"_blank\">Events Calendar Pro<\/a> allows you to display additional upcoming events on your single events pages, based on the <a href=\"https:\/\/staging.theeventscalendar.com\/knowledgebase\/k\/event-categories\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">event category<\/a>.\u00a0If you&#8217;re not using event categories or simply find it more useful to show your users other events happening at the same venue, this snippet is here to help!<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nfunction tribe_modify_related_posts_args ( $args ) {\n\t$venue_id = tribe_get_venue_id();\n\n\tif ( $venue_id ) {\n\t\tunset( $args&#x5B;&#039;tax_query&#039;] );\n\t\t$args&#x5B;&#039;meta_query&#039;] = &#x5B;\n\t\t\t&#039;relation&#039; =&gt; &#039;AND&#039;,\n\t\t\t&#x5B;\n\t\t\t\t&#039;key&#039; =&gt; &#039;_EventVenueID&#039;,\n\t\t\t\t&#039;value&#039; =&gt; $venue_id,\n\t\t\t\t&#039;compare&#039; =&gt; &#039;=&#039;,\n\t\t\t]\n\t\t];\n\t}\n\n\treturn $args;\n}\nadd_filter( &#039;tribe_related_posts_args&#039;, &#039;tribe_modify_related_posts_args&#039; );\n<\/pre><\/div>\n\n\n<p>Add this to the functions.php file of your child theme, and voila! Your Related Events section will now display upcoming events by venue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Plugins<\/h2>\n\n\n\n<p>Events Calendar Pro<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Originally written in May 2019<\/li><li>Tested with The Events Calendar 4.9.2 and Events Calendar Pro 4.7.2<\/li><li>Author: Jennifer<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Disclaimer<\/h2>\n\n\n\n<p>As with all of our recipes, please note that we share this in the hope it will be useful <strong>but without any guarantees or commitments<\/strong>. If you wish to use it, it is your responsibility to test it and adapt it to your needs (or find someone who can do so on your behalf). We are unable to provide further support in relation to this recipe.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Related Events feature of Events Calendar Pro allows you to display additional upcoming events on your single events pages, based on the event category.\u00a0If you&#8217;re not using event categories or simply find it more useful to show your users other events happening at the same venue, this snippet is here to help! Add this&#8230;<\/p>\n","protected":false},"author":2,"featured_media":1955565,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[79],"tags":[25,96],"stellar-product-taxonomy":[158,161],"class_list":["post-1896728","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippets","tag-customizations","tag-venues","stellar-product-taxonomy-events-calendar-pro","stellar-product-taxonomy-the-events-calendar"],"acf":[],"taxonomy_info":{"category":[{"value":79,"label":"Snippets"}],"post_tag":[{"value":25,"label":"Customizations"},{"value":96,"label":"Venues"}],"stellar-product-taxonomy":[{"value":158,"label":"Events Calendar Pro"},{"value":161,"label":"The Events Calendar"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"zach","author_link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/author\/zach\/"},"comment_info":0,"category_info":[{"term_id":79,"name":"Snippets","slug":"snippets","term_group":0,"term_taxonomy_id":79,"taxonomy":"category","description":"","parent":0,"count":136,"filter":"raw","term_order":"0","cat_ID":79,"category_count":136,"category_description":"","cat_name":"Snippets","category_nicename":"snippets","category_parent":0}],"tag_info":[{"term_id":25,"name":"Customizations","slug":"customizations","term_group":0,"term_taxonomy_id":25,"taxonomy":"post_tag","description":"","parent":0,"count":177,"filter":"raw","term_order":"0"},{"term_id":96,"name":"Venues","slug":"venues","term_group":0,"term_taxonomy_id":96,"taxonomy":"post_tag","description":"","parent":0,"count":9,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1896728"}],"version-history":[{"count":1,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896728\/revisions"}],"predecessor-version":[{"id":1956102,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896728\/revisions\/1956102"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1896728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1896728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1896728"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1896728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}