{"id":1286967,"date":"2017-05-21T23:59:18","date_gmt":"2017-05-22T06:59:18","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/"},"modified":"2017-05-22T19:16:33","modified_gmt":"2017-05-23T02:16:33","slug":"short-code-2","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/","title":{"rendered":"short code"},"content":{"rendered":"<p>I have this function<br \/>\n$events = tribe_get_events( array(<br \/>\n&#8216;author&#8217; =&gt; $user_id,<br \/>\n&#8216;order&#8217; =&gt; &#8216;ASC&#8217;,<br \/>\n&#8216;meta_query&#8217; =&gt; array(<br \/>\narray(<br \/>\n&#8216;key&#8217; =&gt; &#8216;_EventStartDate&#8217;,<br \/>\n&#8216;value&#8217; =&gt; date( &#8216;Y-m-d H:i:s&#8217; ),<br \/>\n&#8216;type&#8217; =&gt; &#8216;DATETIME&#8217;,<br \/>\n&#8216;compare&#8217; =&gt; &#8216;&gt;&#8217;,<br \/>\n),<br \/>\narray(<br \/>\n&#8216;key&#8217; =&gt; &#8216;_EventRecurrence&#8217;,<br \/>\n&#8216;compare&#8217; =&gt; &#8216;EXISTS&#8217;,<br \/>\n),<br \/>\n),<br \/>\n) );<br \/>\nwhen i am using this function inside the short code you have provided me for user event count<br \/>\nfunction tribe_do_user_events ( $atts ) {<\/p>\n<p>if ( $user_id = get_current_user_id() &amp;&amp; function_exists(&#8216;tribe_get_events&#8217;) ) {<\/p>\n<p>$events = tribe_get_events( array(<br \/>\n&#8216;author&#8217; =&gt; $user_id,<br \/>\n&#8216;order&#8217; =&gt; &#8216;ASC&#8217;,<br \/>\n&#8216;meta_query&#8217; =&gt; array(<br \/>\narray(<br \/>\n&#8216;key&#8217; =&gt; &#8216;_EventStartDate&#8217;,<br \/>\n&#8216;value&#8217; =&gt; date( &#8216;Y-m-d H:i:s&#8217; ),<br \/>\n&#8216;type&#8217; =&gt; &#8216;DATETIME&#8217;,<br \/>\n&#8216;compare&#8217; =&gt; &#8216;&gt;&#8217;,<br \/>\n),<br \/>\narray(<br \/>\n&#8216;key&#8217; =&gt; &#8216;_EventRecurrence&#8217;,<br \/>\n&#8216;compare&#8217; =&gt; &#8216;EXISTS&#8217;,<br \/>\n),<br \/>\n),<br \/>\n) );<\/p>\n<p>if ( empty ($events) ) return &#8216;No events for this user&#8217;;<\/p>\n<p>$return_events = &#8221;;<\/p>\n<p>foreach ( $events as $post ) {<br \/>\nsetup_postdata( $post );<\/p>\n<p>$return_events .= &#8221; . $post-&gt;post_title . &#8216; &#8211; &#8216; . tribe_get_start_date( $post ) . &#8221;;<br \/>\n}<\/p>\n<p>$return_events .= &#8221;;<\/p>\n<p>return $return_events;<br \/>\n}<\/p>\n<p>}<br \/>\nadd_shortcode( &#8216;tribe_user_events&#8217;, &#8216;tribe_do_user_events&#8217; );<br \/>\n\/*<br \/>\nit is returning all the events not only future and recurring events.<br \/>\nPlease indly help me out<\/p>\n","protected":false},"template":"","class_list":["post-1286967","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>short code -<\/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\/short-code-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"short code -\" \/>\n<meta property=\"og:description\" content=\"I have this function $events = tribe_get_events( array( &#8216;author&#8217; =&gt; $user_id, &#8216;order&#8217; =&gt; &#8216;ASC&#8217;, &#8216;meta_query&#8217; =&gt; array( array( &#8216;key&#8217; =&gt; &#8216;_EventStartDate&#8217;, &#8216;value&#8217; =&gt; date( &#8216;Y-m-d H:i:s&#8217; ), &#8216;type&#8217; =&gt; &#8216;DATETIME&#8217;, &#8216;compare&#8217; =&gt; &#8216;&gt;&#8217;, ), array( &#8216;key&#8217; =&gt; &#8216;_EventRecurrence&#8217;, &#8216;compare&#8217; =&gt; &#8216;EXISTS&#8217;, ), ), ) ); when i am using this function inside the short code [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/\" \/>\n<meta property=\"article:modified_time\" content=\"2017-05-23T02:16:33+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\/short-code-2\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/\",\"name\":\"short code -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-05-22T06:59:18+00:00\",\"dateModified\":\"2017-05-23T02:16:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/#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\":\"short code\"}]},{\"@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":"short code -","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\/short-code-2\/","og_locale":"en_US","og_type":"article","og_title":"short code -","og_description":"I have this function $events = tribe_get_events( array( &#8216;author&#8217; =&gt; $user_id, &#8216;order&#8217; =&gt; &#8216;ASC&#8217;, &#8216;meta_query&#8217; =&gt; array( array( &#8216;key&#8217; =&gt; &#8216;_EventStartDate&#8217;, &#8216;value&#8217; =&gt; date( &#8216;Y-m-d H:i:s&#8217; ), &#8216;type&#8217; =&gt; &#8216;DATETIME&#8217;, &#8216;compare&#8217; =&gt; &#8216;&gt;&#8217;, ), array( &#8216;key&#8217; =&gt; &#8216;_EventRecurrence&#8217;, &#8216;compare&#8217; =&gt; &#8216;EXISTS&#8217;, ), ), ) ); when i am using this function inside the short code [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/","article_modified_time":"2017-05-23T02:16:33+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\/short-code-2\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/","name":"short code -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-05-22T06:59:18+00:00","dateModified":"2017-05-23T02:16:33+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/short-code-2\/#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":"short code"}]},{"@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\/1286967","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\/1286967\/revisions"}],"predecessor-version":[{"id":1287424,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1286967\/revisions\/1287424"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1286967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}