{"id":396438,"date":"2014-07-15T11:20:27","date_gmt":"2014-07-15T18:20:27","guid":{"rendered":"http:\/\/tri.be\/support\/forums\/topic\/possibly-making-events-dynamic\/"},"modified":"2015-07-07T06:31:00","modified_gmt":"2015-07-07T13:31:00","slug":"possibly-making-events-dynamic","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/","title":{"rendered":"Date comparison"},"content":{"rendered":"<p>Hello everyone!<br \/>\nSo our company is currently use Events Calendar pro. Right now for the custom fields section, I have an option to display the event on the homepage or not. If yes is selected, it gets generated\/added to the plugin we use to display an event carousel called bxSlider. <\/p>\n<p>Currently, whenever an event ends, I have to manually go in and select no for &#8220;Display on homepage&#8221;. I was wondering if anyone knew of a way to make it so that it would automatically fall off once the event date &amp; time passes?<\/p>\n<p>This is the query that we currently have. I was thinking that I would have to add in the &#8220;if(strtolower($linkr)==&#8217;yes&#8217;)&#8221; something along the lines of &#8220;and if the tribe_get_end_date &gt; today&#8221; but I don&#8217;t know how to write that part.<\/p>\n<p>&lt;?php $query_str = &#8220;SELECT distinct wposts.ID FROM $wpdb-&gt;posts wposts, $wpdb-&gt;postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id  AND wpostmeta.meta_key = &#8216;_EventStartDate&#8217; AND wposts.post_type = &#8216;tribe_events&#8217; ORDER BY wpostmeta.meta_value ASC &#8220;;<\/p>\n<p>$posts = $wpdb-&gt;get_results( $query_str );<br \/>\n            foreach($posts as $post){<br \/>\n                setup_postdata($post);<br \/>\n                $id=get_the_ID();<br \/>\n                $linkr=get_post_meta($id,&#8217;_ecp_custom_3&#8242;,true);<br \/>\n                if (strtolower($linkr)==&#8217;yes&#8217;) {<br \/>\n                    $link=get_permalink($id);<br \/>\n                    echo &#8220;&#8221;;<br \/>\n}<br \/>\n}<br \/>\n?&gt;<\/p>\n<p>Website: http:\/\/www.lightgroup.com<\/p>\n","protected":false},"template":"","class_list":["post-396438","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Date comparison -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Date comparison -\" \/>\n<meta property=\"og:description\" content=\"Hello everyone! So our company is currently use Events Calendar pro. Right now for the custom fields section, I have an option to display the event on the homepage or not. If yes is selected, it gets generated\/added to the plugin we use to display an event carousel called bxSlider. Currently, whenever an event ends, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-07-07T13:31:00+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/\",\"name\":\"Date comparison -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2014-07-15T18:20:27+00:00\",\"dateModified\":\"2015-07-07T13:31:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Date comparison\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Date comparison -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/","og_locale":"en_US","og_type":"article","og_title":"Date comparison -","og_description":"Hello everyone! So our company is currently use Events Calendar pro. Right now for the custom fields section, I have an option to display the event on the homepage or not. If yes is selected, it gets generated\/added to the plugin we use to display an event carousel called bxSlider. Currently, whenever an event ends, [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/","article_modified_time":"2015-07-07T13:31:00+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/","name":"Date comparison -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2014-07-15T18:20:27+00:00","dateModified":"2015-07-07T13:31:00+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/possibly-making-events-dynamic\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Date comparison"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/396438","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/396438\/revisions"}],"predecessor-version":[{"id":983406,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/396438\/revisions\/983406"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=396438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}