{"id":1098218,"date":"2016-04-05T00:56:40","date_gmt":"2016-04-05T07:56:40","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/"},"modified":"2016-04-26T09:35:07","modified_gmt":"2016-04-26T16:35:07","slug":"show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/","title":{"rendered":"Show past events if upcoming there are no upcoming events on homepage"},"content":{"rendered":"<p>Good Day, <\/p>\n<p>I&#8217;m doing a project on my site. and i&#8217;d like to post the past events if there are no upcoming events on my site. <\/p>\n<p>here&#8217;s my code just posting only upcoming events: <\/p>\n<p>&lt;div class=&#8221;events&#8221;&gt;<\/p>\n<p>             \t&lt;!&#8211;Here comes the loop with tribe_events post type&#8211;&gt;<br \/>\n                &lt;?php $loop = new WP_Query( array( &#8216;post_type&#8217; =&gt; &#8216;tribe_events&#8217;, &#8216;posts_per_page&#8217; =&gt; &#8216;4&#8217;, &#8216;orderby&#8217; =&gt; &#8216;date&#8217;, &#8216;order&#8217; =&gt; &#8216;ASC&#8217;, ) ); ?&gt;<\/p>\n<p>                &lt;?php while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); ?&gt;<\/p>\n<p>            \t&lt;div class=&#8221;event-wrap&#8221;&gt;<\/p>\n<ul>\n<li>\n                        &lt;!&#8211; Event Title &#8211;&gt;<br \/>\n\t\t\t\t\t\t&lt;?php do_action( &#8216;tribe_events_before_the_event_title&#8217; ) ?&gt;<\/p>\n<h3>\n                            <a>&#8221; title=&#8221;&lt;?php the_title_attribute() ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;<br \/>\n                            &lt;?php the_title() ?&gt;<br \/>\n                            <\/a><br \/>\n\t\t\t\t\t\t<\/h3>\n<p>\t\t\t\t\t\t&lt;?php do_action( &#8216;tribe_events_after_the_event_title&#8217; ) ?&gt;<\/p>\n<p>                        &lt;div class=&#8221;date&#8221;&gt;&lt;?php echo tribe_get_start_date( null, false, &#8216;M j, Y&#8217; ); ?&gt; &#8211; &lt;?php echo tribe_get_end_date( null, false, &#8216;M j, Y&#8217; ); ?&gt; &lt;\/div&gt;<br \/>\n                        &lt;!&#8211; Event Image &#8211;&gt;<br \/>\n\t\t\t\t\t\t&lt;?php echo tribe_event_featured_image( null, &#8216;medium&#8217; ) ?&gt;<\/p>\n<p>                        &lt;!&#8211; Event Content &#8211;&gt;<br \/>\n                        &lt;?php do_action( &#8216;tribe_events_before_the_content&#8217; ) ?&gt;<br \/>\n                        &lt;div class=&#8221;tribe-events-list-event-description tribe-events-content&#8221;&gt;<br \/>\n\t\t\t\t\t\t&lt;?php echo tribe_events_get_the_excerpt( null, wp_kses_allowed_html( &#8216;post&#8217; ) ); ?&gt;<br \/>\n\t\t\t\t\t\t&lt;\/div&gt;&lt;!&#8211; .tribe-events-list-event-description &#8211;&gt;<br \/>\n\t\t\t\t\t\t&lt;?php<br \/>\n                        do_action( &#8216;tribe_events_after_the_content&#8217; );<br \/>\n\t\t\t\t\t\t?&gt;<\/p>\n<\/li>\n<\/ul>\n<p>                &lt;\/div&gt;&lt;!&#8211; event-wrap &#8211;&gt;<br \/>\n                 &lt;?php endwhile; ?&gt;<br \/>\n            \t &lt;div class=&#8221;clear&#8221;&gt;&lt;\/div&gt;<br \/>\n             &lt;\/div&gt;&lt;!&#8211; events &#8211;&gt;<\/p>\n<p>can anyone help me. <\/p>\n<p>Thanks in advance.<\/p>\n","protected":false},"template":"","class_list":["post-1098218","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>Show past events if upcoming there are no upcoming events on homepage -<\/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\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Show past events if upcoming there are no upcoming events on homepage -\" \/>\n<meta property=\"og:description\" content=\"Good Day, I&#8217;m doing a project on my site. and i&#8217;d like to post the past events if there are no upcoming events on my site. here&#8217;s my code just posting only upcoming events: &lt;div class=&#8221;events&#8221;&gt; &lt;!&#8211;Here comes the loop with tribe_events post type&#8211;&gt; &lt;?php $loop = new WP_Query( array( &#8216;post_type&#8217; =&gt; &#8216;tribe_events&#8217;, &#8216;posts_per_page&#8217; =&gt; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-04-26T16:35:07+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\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/\",\"name\":\"Show past events if upcoming there are no upcoming events on homepage -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-04-05T07:56:40+00:00\",\"dateModified\":\"2016-04-26T16:35:07+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/#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\":\"Welcome!\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Pre-Sales Questions\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Show past events if upcoming there are no upcoming events on homepage\"}]},{\"@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":"Show past events if upcoming there are no upcoming events on homepage -","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\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/","og_locale":"en_US","og_type":"article","og_title":"Show past events if upcoming there are no upcoming events on homepage -","og_description":"Good Day, I&#8217;m doing a project on my site. and i&#8217;d like to post the past events if there are no upcoming events on my site. here&#8217;s my code just posting only upcoming events: &lt;div class=&#8221;events&#8221;&gt; &lt;!&#8211;Here comes the loop with tribe_events post type&#8211;&gt; &lt;?php $loop = new WP_Query( array( &#8216;post_type&#8217; =&gt; &#8216;tribe_events&#8217;, &#8216;posts_per_page&#8217; =&gt; [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/","article_modified_time":"2016-04-26T16:35:07+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\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/","name":"Show past events if upcoming there are no upcoming events on homepage -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-04-05T07:56:40+00:00","dateModified":"2016-04-26T16:35:07+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/show-past-events-if-upcoming-there-are-no-upcoming-events-on-homepage\/#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":"Welcome!","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/"},{"@type":"ListItem","position":4,"name":"Pre-Sales Questions","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/"},{"@type":"ListItem","position":5,"name":"Show past events if upcoming there are no upcoming events on homepage"}]},{"@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\/1098218","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\/1098218\/revisions"}],"predecessor-version":[{"id":1098867,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1098218\/revisions\/1098867"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1098218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}