{"id":938049,"date":"2015-01-27T07:22:38","date_gmt":"2015-01-27T15:22:38","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/"},"modified":"2015-01-27T13:02:56","modified_gmt":"2015-01-27T21:02:56","slug":"custom-events-loop-trying-to-add-no-upcoming-events-message","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/","title":{"rendered":"Custom events loop, trying to add &#039;no upcoming events message&#039;"},"content":{"rendered":"<p>Hi, as title suggests, I&#8217;m trying to create a custom event loop containing only content from 1 event specific category. I&#8217;ve managed this far, but I&#8217;m having trouble adding the code needed so that it displays a &#8216;no upcoming events&#8217; if no events exist in that category? I&#8217;ve looked at &#8216;list-widget.php&#8217; for example for clues and tried: `&lt;?php<br \/>\n\/\/ No Events were Found<br \/>\nelse:<br \/>\n\t?&gt;<br \/>\n\t&lt;p&gt;&lt;?php _e( &#8216;There are no upcoming events at this time.&#8217;, &#8216;tribe-events-calendar&#8217; ) ?&gt;&lt;\/p&gt;<br \/>\n&lt;?php<br \/>\nendif;<\/p>\n<p>But perhaps its in the wrong order? Anyways, here&#8217;s the code i&#8217;ve got so far:<\/p>\n<p>`&lt;div class=&#8221;events-loop&#8221;&gt;<\/p>\n<p>\t&lt;?php $loop = new WP_Query( array( &#8216;post_type&#8217; =&gt; &#8216;tribe_events&#8217;, &#8216;posts_per_page&#8217; =&gt; 4,&#8217;tax_query&#8217; =&gt; array(<br \/>\n\tarray(<br \/>\n\t\t&#8216;taxonomy&#8217; =&gt; &#8216;tribe_events_cat&#8217;,<br \/>\n\t\t&#8216;field&#8217; =&gt; &#8216;slug&#8217;,<br \/>\n\t\t&#8216;terms&#8217; =&gt; &#8216;event-type-1&#8217;<br \/>\n\t\t)<br \/>\n\t) ) ); ?&gt;<\/p>\n<p>\t&lt;?php while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); ?&gt;<br \/>\n&lt;div class=&#8221;training-item&#8221;&gt;<br \/>\n\t&lt;?php do_action( &#8216;tribe_events_before_the_event_title&#8217; ) ?&gt;<br \/>\n&lt;h3 class=&#8221;tribe-events-list-event-title entry-title summary&#8221;&gt;<br \/>\n\t<a>&#8221; title=&#8221;&lt;?php the_title() ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;<br \/>\n\t\t&lt;?php the_title() ?&gt;<br \/>\n\t<\/a><br \/>\n&lt;\/h3&gt;<br \/>\n&lt;?php do_action( &#8216;tribe_events_after_the_event_title&#8217; ) ?&gt;<\/p>\n<p>&lt;!&#8211; Event Meta &#8211;&gt;<br \/>\n&lt;?php do_action( &#8216;tribe_events_before_the_meta&#8217; ) ?&gt;<br \/>\n&lt;div class=&#8221;tribe-events-event-meta vcard&#8221;&gt;<br \/>\n\t&lt;div class=&#8221;author &lt;?php echo $has_venue_address; ?&gt;&#8221;&gt;<\/p>\n<p>\t\t&lt;!&#8211; Schedule &amp; Recurrence Details &#8211;&gt;<br \/>\n\t\t&lt;div class=&#8221;updated published time-details&#8221;&gt;<br \/>\n\t\t\t&lt;?php echo tribe_events_event_schedule_details() ?&gt;<br \/>\n\t\t&lt;\/div&gt;<\/p>\n<p>\t\t&lt;?php if ( $venue_details ) : ?&gt;<br \/>\n\t\t\t&lt;!&#8211; Venue Display Info &#8211;&gt;<br \/>\n\t\t\t&lt;div class=&#8221;tribe-events-venue-details&#8221;&gt;<br \/>\n\t\t\t\t&lt;?php echo implode( &#8216;, &#8216;, $venue_details ); ?&gt;<br \/>\n\t\t\t&lt;\/div&gt; &lt;!&#8211; .tribe-events-venue-details &#8211;&gt;<br \/>\n\t\t&lt;?php endif; ?&gt;<\/p>\n<p>\t&lt;\/div&gt;<br \/>\n&lt;\/div&gt;&lt;!&#8211; .tribe-events-event-meta &#8211;&gt;<\/p>\n<p>&lt;!&#8211; Event Image &#8211;&gt;<br \/>\n&lt;?php echo tribe_event_featured_image( ) ?&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 description entry-summary&#8221;&gt;<br \/>\n\t&lt;?php the_excerpt() ?&gt;<br \/>\n\t<a>&#8221; class=&#8221;tribe-events-read-more&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;h4&gt;&lt;?php _e( &#8216;View course information \/ book tickets&#8217;, &#8216;tribe-events-calendar&#8217; ) ?&gt;  &raquo; &lt;\/h4&gt;<\/a><br \/>\n&lt;\/div&gt;<br \/>\n&lt;!&#8211; .tribe-events-list-event-description &#8211;&gt;<br \/>\n&lt;?php do_action( &#8216;tribe_events_after_the_content&#8217; ) ?&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>&lt;?php endwhile;wp_reset_query(); ?&gt;<\/p>\n<p>\t&lt;\/div&gt;<\/p>\n<p>Thanks,<br \/>\nBen<\/p>\n","protected":false},"template":"","class_list":["post-938049","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>Custom events loop, trying to add &#039;no upcoming events message&#039; -<\/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\/custom-events-loop-trying-to-add-no-upcoming-events-message\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom events loop, trying to add &#039;no upcoming events message&#039; -\" \/>\n<meta property=\"og:description\" content=\"Hi, as title suggests, I&#8217;m trying to create a custom event loop containing only content from 1 event specific category. I&#8217;ve managed this far, but I&#8217;m having trouble adding the code needed so that it displays a &#8216;no upcoming events&#8217; if no events exist in that category? I&#8217;ve looked at &#8216;list-widget.php&#8217; for example for clues [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-01-27T21:02:56+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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/\",\"name\":\"Custom events loop, trying to add &#039;no upcoming events message&#039; -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-01-27T15:22:38+00:00\",\"dateModified\":\"2015-01-27T21:02:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/#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\":\"Custom events loop, trying to add &#039;no upcoming events message&#039;\"}]},{\"@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":"Custom events loop, trying to add &#039;no upcoming events message&#039; -","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\/custom-events-loop-trying-to-add-no-upcoming-events-message\/","og_locale":"en_US","og_type":"article","og_title":"Custom events loop, trying to add &#039;no upcoming events message&#039; -","og_description":"Hi, as title suggests, I&#8217;m trying to create a custom event loop containing only content from 1 event specific category. I&#8217;ve managed this far, but I&#8217;m having trouble adding the code needed so that it displays a &#8216;no upcoming events&#8217; if no events exist in that category? I&#8217;ve looked at &#8216;list-widget.php&#8217; for example for clues [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/","article_modified_time":"2015-01-27T21:02:56+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/","name":"Custom events loop, trying to add &#039;no upcoming events message&#039; -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-01-27T15:22:38+00:00","dateModified":"2015-01-27T21:02:56+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-events-loop-trying-to-add-no-upcoming-events-message\/#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":"Custom events loop, trying to add &#039;no upcoming events message&#039;"}]},{"@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\/938049","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\/938049\/revisions"}],"predecessor-version":[{"id":938096,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/938049\/revisions\/938096"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=938049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}