{"id":1966675,"date":"2025-09-04T22:27:25","date_gmt":"2025-09-05T02:27:25","guid":{"rendered":"https:\/\/theeventscalendar.com\/knowledgebase\/?p=1966675"},"modified":"2026-04-15T18:40:35","modified_gmt":"2026-04-15T22:40:35","slug":"customizing-shortcodes","status":"publish","type":"post","link":"https:\/\/theeventscalendar.com\/knowledgebase\/customizing-shortcodes\/","title":{"rendered":"Customizing with The Events Calendar Shortcodes"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-show-only-weekend-events-in-list-view-shortcode\">Show Only Weekend Events in List View Shortcode<\/h2>\n\n\n\n<p>Sometimes you may want your events calendar to focus only on the weekend. For example, maybe you run classes or workshops every Saturday and Sunday, and you want a dedicated page that shows only those events.<\/p>\n\n\n\n<p>With <strong>Events Calendar Pro<\/strong>, this can be done by modifying the query that powers the List View shortcode. In this guide, we\u2019ll show you how to use the <code>tribe_events_views_v2_view_repository_args<\/code> filter so a <strong>specific List View shortcode<\/strong> only returns events that start on Saturday or Sunday of the current week.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-how-it-works\">How It Works<\/h4>\n\n\n\n<p>The <code>tribe_events_views_v2_view_repository_args<\/code> filter lets you change the arguments used to fetch events for any view in The Events Calendar. By checking the <strong>shortcode ID<\/strong>, you can apply the customization only to one shortcode and leave the rest of your site unchanged.<\/p>\n\n\n\n<p>The code snippet below calculates the start and end of the current weekend, then restricts the query to only include events that start between <strong>Saturday 00:00:00 and Sunday 23:59:59<\/strong>. You can add this snippet in your child theme&#8217;s <strong>functions.php<\/strong> or via <a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" target=\"_blank\" rel=\"noreferrer noopener\">Code Snippets<\/a> plugin.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/**\n * Show only weekend events (Saturday &amp; Sunday) in a specific List View shortcode.\n *\/\nadd_filter( &#039;tribe_events_views_v2_view_repository_args&#039;, &#039;my_weekend_repo_args&#039;, 10, 2 );\nfunction my_weekend_repo_args( $rep_args, $context ) {\n\t$shortcode_id = &#039;24f53d40&#039;; \/\/ Replace with your shortcode ID\n\n\t\/\/ Only run for the correct shortcode\n\tif ( empty( $context-&gt;get( &#039;shortcode&#039; ) ) || $context-&gt;get( &#039;shortcode&#039; ) !== $shortcode_id ) {\n\t\treturn $rep_args;\n\t}\n\n\t\/\/ Use site timezone\n\t$tz = wp_timezone();\n\n\t\/\/ Calculate weekend range (Saturday 00:00:00 to Sunday 23:59:59 this week)\n\t$weekend_start = new DateTime( &#039;saturday this week 00:00:00&#039;, $tz );\n\t$weekend_end   = new DateTime( &#039;sunday this week 23:59:59&#039;, $tz );\n\n\t\/\/ Apply weekend range to repository arguments\n\t$rep_args&#x5B;&#039;start_date&#039;] = $weekend_start-&gt;format( &#039;Y-m-d H:i:s&#039; );\n\t$rep_args&#x5B;&#039;end_date&#039;]   = $weekend_end-&gt;format( &#039;Y-m-d H:i:s&#039; );\n\n\t\/\/ Keep ordering predictable\n\t$rep_args&#x5B;&#039;orderby&#039;] = &#039;event_date&#039;;\n\t$rep_args&#x5B;&#039;order&#039;]   = &#039;ASC&#039;;\n\n\t\/\/ Optional: set posts per page if not already defined\n\tif ( empty( $rep_args&#x5B;&#039;posts_per_page&#039;] ) ) {\n\t\t$rep_args&#x5B;&#039;posts_per_page&#039;] = tribe_get_option( &#039;postsPerPage&#039;, 10 );\n\t}\n\n\treturn $rep_args;\n}\n<\/pre><\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"h-finding-your-shortcode-id\">Finding Your Shortcode ID<\/h4>\n\n\n\n<p>Each List View shortcode in The Events Calendar has a unique ID. To find it:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Add a List View shortcode to a post or page.<\/li>\n\n\n\n<li>Inspect the page source in your browser.<\/li>\n\n\n\n<li>Look for the <code>data-view-shortcode<\/code> attribute inside the List View wrapper.<\/li>\n\n\n\n<li>Copy that ID and replace <code>24f53d40<\/code> in the code above on line 6 with your shortcode\u2019s ID.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full has-custom-border\"><img loading=\"lazy\" decoding=\"async\" width=\"1587\" height=\"347\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/09\/shortcode_id.png\" alt=\"\" class=\"wp-image-1966676\" style=\"border-width:1px;object-fit:cover\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/09\/shortcode_id.png 1587w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/09\/shortcode_id-300x66.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/09\/shortcode_id-1024x224.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/09\/shortcode_id-768x168.png 768w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2025\/09\/shortcode_id-1536x336.png 1536w\" sizes=\"auto, (max-width: 1587px) 100vw, 1587px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-example-use-case\">Example Use Case<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You create a page called <strong>Weekend Events<\/strong>.<\/li>\n\n\n\n<li>Add a <code>[tribe_events view=\"list\"]<\/code> shortcode to the page.<\/li>\n\n\n\n<li>Copy the shortcode\u2019s unique ID and add it to the code snippet.<\/li>\n\n\n\n<li>Now, that page will only display events that <strong>start on Saturday or Sunday of the current week<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p>This creates a clean, dedicated weekend schedule while leaving your main calendar and other shortcodes unaffected.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-optional-enhancements\">Optional Enhancements<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Future weekends<\/strong>: You can adjust the DateTime strings (<code>saturday next week<\/code>, <code>sunday next week<\/code>) if you want to show events from upcoming weekends.<\/li>\n\n\n\n<li><strong>Multi-day events<\/strong>: If you want to include events that overlap the weekend even if they start earlier, you\u2019ll need a slightly different query that checks both start and end dates.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h4>\n\n\n\n<p>By customizing repository arguments with <code>tribe_events_views_v2_view_repository_args<\/code>, you can display only weekend events in a specific List View shortcode. This keeps your customization scoped and avoids changing the behavior of other views or shortcodes on your site.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Show Only Weekend Events in List View Shortcode Sometimes you may want your events calendar to focus only on the weekend. For example, maybe you run classes or workshops every Saturday and Sunday, and you want a dedicated page that shows only those events. With Events Calendar Pro, this can be done by modifying the&#8230;<\/p>\n","protected":false},"author":84,"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":[24,59,77],"tags":[],"stellar-product-taxonomy":[158],"class_list":["post-1966675","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-customizing","category-php-function-snippets","category-shortcodes","stellar-product-taxonomy-events-calendar-pro"],"acf":[],"taxonomy_info":{"category":[{"value":24,"label":"Customizations"},{"value":59,"label":"PHP Functions &amp; Snippets"},{"value":77,"label":"Shortcodes"}],"stellar-product-taxonomy":[{"value":158,"label":"Events Calendar Pro"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"The Events Calendar Team","author_link":"https:\/\/theeventscalendar.com\/knowledgebase\/author\/the_events_calendar_team\/"},"comment_info":0,"category_info":[{"term_id":24,"name":"Customizations","slug":"customizing","term_group":0,"term_taxonomy_id":24,"taxonomy":"category","description":"","parent":0,"count":77,"filter":"raw","term_order":"0","cat_ID":24,"category_count":77,"category_description":"","cat_name":"Customizations","category_nicename":"customizing","category_parent":0},{"term_id":59,"name":"PHP Functions &amp; Snippets","slug":"php-function-snippets","term_group":0,"term_taxonomy_id":59,"taxonomy":"category","description":"","parent":24,"count":63,"filter":"raw","term_order":"0","cat_ID":59,"category_count":63,"category_description":"","cat_name":"PHP Functions &amp; Snippets","category_nicename":"php-function-snippets","category_parent":24},{"term_id":77,"name":"Shortcodes","slug":"shortcodes","term_group":0,"term_taxonomy_id":77,"taxonomy":"category","description":"","parent":61,"count":12,"filter":"raw","term_order":"0","cat_ID":77,"category_count":12,"category_description":"","cat_name":"Shortcodes","category_nicename":"shortcodes","category_parent":61}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1966675","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\/84"}],"replies":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1966675"}],"version-history":[{"count":7,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1966675\/revisions"}],"predecessor-version":[{"id":1969144,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1966675\/revisions\/1969144"}],"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=1966675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1966675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1966675"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1966675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}