{"id":97757,"date":"2014-01-28T09:33:28","date_gmt":"2014-01-28T17:33:28","guid":{"rendered":"https:\/\/tri.be\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/"},"modified":"2014-02-12T14:24:04","modified_gmt":"2014-02-12T22:24:04","slug":"counting-posts-issue-when-recurring-events-are-introduced","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/","title":{"rendered":"Counting Posts Issue when Recurring events are introduced"},"content":{"rendered":"<p>Hello,<\/p>\n<p>I am having an issue with displaying only 3 posts when recurring events are introduced. I know this is not an issue with the plugin itself, but I have researched and asked other forums with no response. Below is what I have so far. I used the code in this thread (https:\/\/tri.be\/support\/forums\/topic\/reoccuring-event-shows-multiple-times-in-loop\/) to display only one recurring event post, but the others are still counted by the incrementing operator. So if I have posts:<\/p>\n<ul>\n<li>A1 (recurring)<\/li>\n<li>A2 (second recurring)<\/li>\n<li>B<\/li>\n<li>C <\/li>\n<\/ul>\n<p>I only want to display:<\/p>\n<ul>\n<li>A1<\/li>\n<li>B<\/li>\n<li>C<\/li>\n<\/ul>\n<p>Since the incrementing operator is counting A2, I receive this result:<\/p>\n<ul>\n<li>A1<\/li>\n<li>B<\/li>\n<\/ul>\n<p>&lt;p&gt;Here is my code. I&#8217;ve tested placing $event_count2++; in a number of different places without success. I should also note that in places where I do not need to limit the amount of events\/posts shown, this script works beautifully.&lt;\/p&gt;<br \/>\n&lt;p&gt;I&#8217;ve removed all code that wasn&#8217;t pertinent to the issue. it has been replaced by <em>&#8220;\/\/description of what displays there&#8221;<\/em>&lt;\/p&gt;<br \/>\n<code><\/p>\n<p>$event_count2 =1;<br \/>\n$args = array('post_type' =&gt;'tribe_events');<br \/>\n$wp_query = null;<br \/>\n$wp_query = new WP_Query($args);<br \/>\n$postids = Array();<br \/>\nif($wp_query-&gt;have_posts() ) :<br \/>\n\twhile ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post();<br \/>\n\t\t$Sub_Featured_post_event = get_post_meta($post-&gt;ID,'Sub_Featured_post',true);<br \/>\n\t\tif($event_count2&lt;=3 &amp;&amp; $Sub_Featured_post_event=='on'){<br \/>\n\t\t\t$recurring = get_post_meta($post-&gt;ID, '_EventRecurrence', true);<br \/>\n\t\t\tif ( $recurring ) {<br \/>\n\t\t\t\t$holdrecur = maybe_unserialize($recurring);<br \/>\n\t\t\t\t$ifrecur = $holdrecur['type'];<br \/>\n\t\t\t\tif ( $ifrecur == 'None' ) {<br \/>\n\t\t\t\t\/\/NON-RECURRING EVENTS, SET AS NONE IN db.<br \/>\n\t\t\t\t$event_count2++;<br \/>\n\t\t\t\t}else{<br \/>\n\/********** HERE IS WHERE THE ISSUE LIES ************\/<br \/>\n\t\t\t\t\t$thisid = get_the_ID();<br \/>\n\t\t\t\t\tif ( !in_array($thisid, $postids)) {<br \/>\n\t\t\t\t\t\tarray_push($postids, $thisid );<br \/>\n\t\t\t\t\t\t\/\/RECURRING EVENTS<br \/>\n\t\t\t\t\t\t$event_count2++;<br \/>\n\t\t\t\t\t}<br \/>\n\/********** END TROUBLESOME CODE ************\/<br \/>\n\t\t\t\t}<br \/>\n\t\t\t}else{<br \/>\n\t\t\t\/\/NON-RECURRING EVENTS, NOTHING IN DATABASE<br \/>\n\t\t\t$event_count2++;<br \/>\n\t\t\t}<br \/>\n\t\t}<br \/>\n\tendwhile;<br \/>\nendif;<br \/>\nwp_reset_query();<br \/>\n<\/code><\/p>\n","protected":false},"template":"","class_list":["post-97757","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>Counting Posts Issue when Recurring events are introduced -<\/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\/counting-posts-issue-when-recurring-events-are-introduced\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Counting Posts Issue when Recurring events are introduced -\" \/>\n<meta property=\"og:description\" content=\"Hello, I am having an issue with displaying only 3 posts when recurring events are introduced. I know this is not an issue with the plugin itself, but I have researched and asked other forums with no response. Below is what I have so far. I used the code in this thread (https:\/\/tri.be\/support\/forums\/topic\/reoccuring-event-shows-multiple-times-in-loop\/) to display [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/\" \/>\n<meta property=\"article:modified_time\" content=\"2014-02-12T22:24:04+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\/counting-posts-issue-when-recurring-events-are-introduced\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/\",\"name\":\"Counting Posts Issue when Recurring events are introduced -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2014-01-28T17:33:28+00:00\",\"dateModified\":\"2014-02-12T22:24:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/#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\":\"Counting Posts Issue when Recurring events are introduced\"}]},{\"@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":"Counting Posts Issue when Recurring events are introduced -","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\/counting-posts-issue-when-recurring-events-are-introduced\/","og_locale":"en_US","og_type":"article","og_title":"Counting Posts Issue when Recurring events are introduced -","og_description":"Hello, I am having an issue with displaying only 3 posts when recurring events are introduced. I know this is not an issue with the plugin itself, but I have researched and asked other forums with no response. Below is what I have so far. I used the code in this thread (https:\/\/tri.be\/support\/forums\/topic\/reoccuring-event-shows-multiple-times-in-loop\/) to display [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/","article_modified_time":"2014-02-12T22:24:04+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\/counting-posts-issue-when-recurring-events-are-introduced\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/","name":"Counting Posts Issue when Recurring events are introduced -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2014-01-28T17:33:28+00:00","dateModified":"2014-02-12T22:24:04+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/counting-posts-issue-when-recurring-events-are-introduced\/#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":"Counting Posts Issue when Recurring events are introduced"}]},{"@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\/97757","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":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/97757\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=97757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}