{"id":1351872,"date":"2017-09-20T07:22:19","date_gmt":"2017-09-20T14:22:19","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/"},"modified":"2017-09-20T16:49:25","modified_gmt":"2017-09-20T23:49:25","slug":"using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/","title":{"rendered":"Using Tribe_Get_Events is causing featured images in main calendar to break?"},"content":{"rendered":"<p>Hi ECP, <\/p>\n<p>Using the following code to create a &#8216;billboard&#8217; like upcoming event list on our homepage. The code is sourced as per your<br \/>\n<a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/using-tribe_get_events\/\">https:\/\/theeventscalendar.com\/knowledgebase\/using-tribe_get_events\/<\/a> link.<\/p>\n<pre><code>&lt;?php\n\/\/ Ensure the global $post variable is in scope\nglobal $post;\n \n\/\/ Retrieve the next 5 upcoming events\n$events = tribe_get_events( array(\n\t&#039;post_status&#039;=&gt;&#039;publish&#039;,\n\t&#039;eventDisplay&#039;   =&gt; &#039;list&#039;,\n    &#039;posts_per_page&#039; =&gt; 6\n\n) );\n \n\/\/ Loop through the events: set up each one as\n\/\/ the current post then use template tags to\n\/\/ display the title and content\nforeach ( $events as $post ) {\n    setup_postdata( $post );\n \n    \/\/ This time, let&#039;s throw in an event-specific\n    \/\/ template tag to show the date after the title!\n        \n        echo &quot; &lt;a href=&#039;$post-&gt;guid&#039;&gt;&lt;li&gt;&lt;span&gt;$post-&gt;post_title &lt;\/span&gt;&lt;\/a&gt;&quot;;\n        echo tribe_get_start_date( $post-&gt;ID, false, &#039;j&lt;\\s\\u\\p&gt;S&lt;\\\/\\s\\u\\p&gt; F Y&#039;, &quot;&lt;\/li&gt;&quot; );\n        }   ?&gt;<\/code><\/pre>\n<p>This is working great, however seems to have messed with the event images in the single-event-photo-view? Event images are displaying correctly on the overall photo view grid layout, however when you choose an event and view it individually they all display a featured image from the same random event?<\/p>\n<p>Is it not ok to use an event loop in multiple places on a site?<\/p>\n<p>Many Thanks,<br \/>\nM<\/p>\n","protected":false},"template":"","class_list":["post-1351872","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>Using Tribe_Get_Events is causing featured images in main calendar to break? -<\/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\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Tribe_Get_Events is causing featured images in main calendar to break? -\" \/>\n<meta property=\"og:description\" content=\"Hi ECP, Using the following code to create a &#8216;billboard&#8217; like upcoming event list on our homepage. The code is sourced as per your https:\/\/theeventscalendar.com\/knowledgebase\/using-tribe_get_events\/ link. &lt;?php \/\/ Ensure the global $post variable is in scope global $post; \/\/ Retrieve the next 5 upcoming events $events = tribe_get_events( array( &#039;post_status&#039;=&gt;&#039;publish&#039;, &#039;eventDisplay&#039; =&gt; &#039;list&#039;, &#039;posts_per_page&#039; =&gt; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/\" \/>\n<meta property=\"article:modified_time\" content=\"2017-09-20T23:49:25+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\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/\",\"name\":\"Using Tribe_Get_Events is causing featured images in main calendar to break? -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-09-20T14:22:19+00:00\",\"dateModified\":\"2017-09-20T23:49:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/#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\":\"Using Tribe_Get_Events is causing featured images in main calendar to break?\"}]},{\"@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":"Using Tribe_Get_Events is causing featured images in main calendar to break? -","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\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/","og_locale":"en_US","og_type":"article","og_title":"Using Tribe_Get_Events is causing featured images in main calendar to break? -","og_description":"Hi ECP, Using the following code to create a &#8216;billboard&#8217; like upcoming event list on our homepage. The code is sourced as per your https:\/\/theeventscalendar.com\/knowledgebase\/using-tribe_get_events\/ link. &lt;?php \/\/ Ensure the global $post variable is in scope global $post; \/\/ Retrieve the next 5 upcoming events $events = tribe_get_events( array( &#039;post_status&#039;=&gt;&#039;publish&#039;, &#039;eventDisplay&#039; =&gt; &#039;list&#039;, &#039;posts_per_page&#039; =&gt; [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/","article_modified_time":"2017-09-20T23:49:25+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\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/","name":"Using Tribe_Get_Events is causing featured images in main calendar to break? -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-09-20T14:22:19+00:00","dateModified":"2017-09-20T23:49:25+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/using-tribe_get_events-is-causing-featured-images-in-main-calendar-to-break\/#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":"Using Tribe_Get_Events is causing featured images in main calendar to break?"}]},{"@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\/1351872","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\/1351872\/revisions"}],"predecessor-version":[{"id":1352345,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1351872\/revisions\/1352345"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1351872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}