{"id":1896718,"date":"2019-10-18T13:19:57","date_gmt":"2019-10-18T17:19:57","guid":{"rendered":"https:\/\/theeventscalendar.com\/knowledgebase\/show-only-todays-events-on-the-mini-calendar-widget-on-first-load\/"},"modified":"2021-04-29T07:52:37","modified_gmt":"2021-04-29T11:52:37","slug":"show-only-todays-events-on-the-mini-calendar-widget-on-first-load","status":"publish","type":"post","link":"https:\/\/theeventscalendar.com\/knowledgebase\/show-only-todays-events-on-the-mini-calendar-widget-on-first-load\/","title":{"rendered":"Show Today&#8217;s Events in the Mini Calendar Widget"},"content":{"rendered":"\n\n\n<h3 class=\"wp-block-heading\">Description<\/h3>\n\n\n\n<p>If you use a Mini Calendar Widget on your site then on the first-page load it will show you the number of events from the month that you set up in the back-end. If you set up 5 events and there are less than that on the current day, it will show you events from the coming days as well.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/knowledgebase\/wp-content\/uploads\/2019\/10\/mini-calendar-widget-recipe-1.jpg\" alt=\"\" class=\"wp-image-1944215\"\/><\/figure>\n\n\n\n<p>If you click on a specific date in the calendar, then you will only see the events for that day.<\/p>\n\n\n\n<p>If you would like to show only today&#8217;s events on the first-page load as well, then the below snippet will help you.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Usage<\/h3>\n\n\n\n<p>Copy the below code into your (child) theme&#8217;s <em>functions.php<\/em> file (or wherever you usually put custom code).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Plugins<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>The Events Calendar<\/li><li>Events Calendar PRO<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Snippet<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nadd_action( &#039;pre_get_posts&#039;, &#039;tribe_andras_custom_mini_calendar_starting_query&#039; );\n\nfunction tribe_andras_custom_mini_calendar_starting_query( $query ) {\n\n\t$is_widget = $query-&gt;get( &#039;is_tribe_widget&#039; );\n\t$event_display = $query-&gt;get( &#039;eventDisplay&#039; );\n\n\tif ( $is_widget &amp;&amp; $event_display == &#039;custom&#039; ) {\n\t\t$query-&gt;set( &#039;eventDisplay&#039;, &#039;day&#039; );\n\t}\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">Notes<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Originally written in April 2019<\/li><li>Tested with The Events Calendar 4.8.2&nbsp; and Events Calendar PRO 4.6.2.1<\/li><li>Author: Andr\u00e1s Guseo<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Disclaimer<\/h3>\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 <em>your<\/em> responsibility to test it first of all 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>Description If you use a Mini Calendar Widget on your site then on the first-page load it will show you the number of events from the month that you set up in the back-end. If you set up 5 events and there are less than that on the current day, it will show you events&#8230;<\/p>\n","protected":false},"author":3,"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,58],"stellar-product-taxonomy":[158,161],"class_list":["post-1896718","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippets","tag-customizations","tag-php","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":58,"label":"PHP"}],"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":"Jaime Marchwinski","author_link":"https:\/\/theeventscalendar.com\/knowledgebase\/author\/jaimetri-be\/"},"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":80,"filter":"raw","term_order":"0","cat_ID":79,"category_count":80,"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":102,"filter":"raw","term_order":"0"},{"term_id":58,"name":"PHP","slug":"php","term_group":0,"term_taxonomy_id":58,"taxonomy":"post_tag","description":"","parent":20,"count":78,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896718","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=1896718"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896718\/revisions"}],"predecessor-version":[{"id":1956109,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896718\/revisions\/1956109"}],"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=1896718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1896718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1896718"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1896718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}