{"id":1961285,"date":"2024-07-08T08:14:07","date_gmt":"2024-07-08T12:14:07","guid":{"rendered":"https:\/\/theeventscalendar.com\/knowledgebase\/?p=1961285"},"modified":"2026-04-22T00:45:15","modified_gmt":"2026-04-22T04:45:15","slug":"customize-related-events","status":"publish","type":"post","link":"https:\/\/theeventscalendar.com\/knowledgebase\/customize-related-events\/","title":{"rendered":"Customizing Related Events"},"content":{"rendered":"\n<p>The &#8220;Related Events&#8221; feature in The Events Calendar plugin is a valuable tool that automatically displays a selection of events related to the one currently being viewed. This feature enhances user engagement by suggesting additional events that match the visitor&#8217;s interests, thereby increasing the likelihood of prolonged site interaction and event attendance. <\/p>\n\n\n\n<p>Showcasing events with similar themes, categories, or locations helps users discover more of what they are interested in without needing to perform additional searches. Additionally, this feature is beneficial for <a href=\"https:\/\/yoast.com\/internal-linking-for-seo-why-and-how\/\" target=\"_blank\" rel=\"noreferrer noopener\">internal linking for SEO<\/a>, as it creates more interconnected pages within your site, improving navigation and potentially boosting your site&#8217;s search engine rankings.<\/p>\n\n\n\n<p>This improves the user experience and helps event organizers promote a more comprehensive range of events, potentially boosting attendance and participation across the board.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1458\" height=\"1163\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/tec-related-events.jpg\" alt=\"\" class=\"wp-image-1961491\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/tec-related-events.jpg 1458w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/tec-related-events-300x239.jpg 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/tec-related-events-1024x817.jpg 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/tec-related-events-768x613.jpg 768w\" sizes=\"auto, (max-width: 1458px) 100vw, 1458px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-change-the-number-of-related-events-displayed\">Change the Number of Related Events Displayed<\/h2>\n\n\n\n<p>By default, the related events section will display three events, but that quantity can be modified by using the following PHP snippet:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nfunction tribe_related_posts_args_limiter ( $args = array() ) { \n$args&#x5B;&#039;posts_per_page&#039;] = 5; \/\/ Change this to whatever number you&#039;d like. \nreturn $args; \n} \nadd_filter( &#039;tribe_related_posts_args&#039;, &#039;tribe_related_posts_args_limiter&#039;, 10, 1 );\n<\/pre><\/div>\n\n\n<p>The code above customizes the quantity to 5, but you can specify any number.<\/p>\n\n\n\n<p>You can find a detailed guide about implementing custom Code Snippets here: <a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/best-practices-for-implementing-custom-code-snippets\/\">Using Custom Code Snippets<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-show-related-events-at-the-same-venue\">Show Related Events at the Same Venue<\/h2>\n\n\n\n<p>The Related Events feature of <a href=\"https:\/\/theeventscalendar.com\/product\/wordpress-events-calendar-pro\/\" target=\"_blank\" rel=\"noopener noreferrer\">Events Calendar Pro<\/a> allows you to display additional upcoming events on your single events pages, based on the <a aria-label=\" (opens in a new tab)\" href=\"https:\/\/theeventscalendar.com\/knowledgebase\/k\/event-categories\/\" target=\"_blank\" rel=\"noreferrer noopener\">event category<\/a>.&nbsp;If 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\" id=\"h-exclude-recurring-event-instances-from-related-events\">Exclude Recurring Event Instances from Related Events<\/h2>\n\n\n\n<p>When working with recurring events, you might notice that multiple instances of the same event series appear in the <strong>Related Events<\/strong> section on an individual event page. At first glance, this can feel unexpected, especially if you\u2019re aiming to use the Related Events area to showcase <em>other<\/em> upcoming events that visitors might be interested in.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1000\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/ztYleoN80C-1-1024x1000.png\" alt=\"\" class=\"wp-image-1967283\" style=\"width:500px\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/ztYleoN80C-1-1024x1000.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/ztYleoN80C-1-300x293.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/ztYleoN80C-1-768x750.png 768w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/ztYleoN80C-1.png 1034w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>For example, if you have a daily recurring event, its other daily instances may fill all the slots, leaving no room for different events from the same category to appear.<\/p>\n\n\n\n<p>Allowing variety in the Related Events section can make your event pages more engaging and useful for visitors. Instead of showing several versions of the same event, you can highlight a mix of upcoming activities, helping visitors discover more of what\u2019s happening on your site and increasing overall event visibility.<\/p>\n\n\n\n<p>Use the following snippet to filter out recurring event instances from the Related Events section, ensuring that only unique events appear instead of multiple dates from the same series.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/masoodahmed\/4a11b3fbc70150cc59f208a5549c9893.js\"><\/script>\n\n\n\n<p>Here&#8217;s how you can add the PHP code snippet to your site,<\/p>\n\n\n\n<p><a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/best-practices-for-implementing-custom-code-snippets\/\">How to Add Custom PHP Code Snippets to WordPress Site<\/a><\/p>\n\n\n\n<p>With this code in place, your Related Events section will now display a more diverse set of events, rather than multiple instances from the same series.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"999\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/bfHwTTKsEV-1024x999.png\" alt=\"\" class=\"wp-image-1967286\" style=\"width:500px\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/bfHwTTKsEV-1024x999.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/bfHwTTKsEV-300x293.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/bfHwTTKsEV-768x749.png 768w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/10\/bfHwTTKsEV.png 1037w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"h-for-developers\">For Developers<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.theeventscalendar.com\/reference\/hooks\/tribe_related_posts_args\/\" target=\"_blank\" rel=\"noreferrer noopener\">tribe_related_posts_args<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.theeventscalendar.com\/apis\/custom-tables\/events\/#series\" target=\"_blank\" rel=\"noreferrer noopener\">tec_series()<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.theeventscalendar.com\/apis\/custom-tables\/events\/#creating-and-reading-events-using-the-orm\" target=\"_blank\" rel=\"noreferrer noopener\">tribe_events()<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.theeventscalendar.com\/reference\/classes\/tec-events-custom_tables-v1-models-occurrence\/normalize_id\/\" target=\"_blank\" rel=\"noreferrer noopener\">Occurrence::normalize_id()<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The &#8220;Related Events&#8221; feature in The Events Calendar plugin is a valuable tool that automatically displays a selection of events related to the one currently being viewed. This feature enhances user engagement by suggesting additional events that match the visitor&#8217;s interests, thereby increasing the likelihood of prolonged site interaction and event attendance. Showcasing events with&#8230;<\/p>\n","protected":false},"author":3,"featured_media":1955565,"comment_status":"open","ping_status":"open","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":[312,24,79],"tags":[],"stellar-product-taxonomy":[161],"class_list":["post-1961285","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-calendar-views","category-customizing","category-snippets","stellar-product-taxonomy-the-events-calendar"],"acf":[],"taxonomy_info":{"category":[{"value":312,"label":"Calendar Views"},{"value":24,"label":"Customizations"},{"value":79,"label":"Snippets"}],"stellar-product-taxonomy":[{"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":"Jaime Marchwinski","author_link":"https:\/\/theeventscalendar.com\/knowledgebase\/author\/jaimetri-be\/"},"comment_info":0,"category_info":[{"term_id":312,"name":"Calendar Views","slug":"calendar-views","term_group":0,"term_taxonomy_id":312,"taxonomy":"category","description":"","parent":61,"count":4,"filter":"raw","term_order":"0","cat_ID":312,"category_count":4,"category_description":"","cat_name":"Calendar Views","category_nicename":"calendar-views","category_parent":61},{"term_id":24,"name":"Customizations","slug":"customizing","term_group":0,"term_taxonomy_id":24,"taxonomy":"category","description":"","parent":0,"count":40,"filter":"raw","term_order":"0","cat_ID":24,"category_count":40,"category_description":"","cat_name":"Customizations","category_nicename":"customizing","category_parent":0},{"term_id":79,"name":"Snippets","slug":"snippets","term_group":0,"term_taxonomy_id":79,"taxonomy":"category","description":"","parent":0,"count":18,"filter":"raw","term_order":"0","cat_ID":79,"category_count":18,"category_description":"","cat_name":"Snippets","category_nicename":"snippets","category_parent":0}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1961285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1961285"}],"version-history":[{"count":9,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1961285\/revisions"}],"predecessor-version":[{"id":1969852,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1961285\/revisions\/1969852"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1961285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1961285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1961285"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1961285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}