{"id":7225232,"date":"2016-03-31T09:13:11","date_gmt":"2016-03-31T09:13:11","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/custom-event-filter\/"},"modified":"2016-08-31T15:17:19","modified_gmt":"2016-08-31T15:17:19","slug":"custom-event-filter","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/custom-event-filter\/","title":{"rendered":"Custom event filter"},"content":{"rendered":"<p>Hi guys,<br \/>\nI can&#8217;t run event search filter in a tabbed page in my home page:<br \/>\nhere the example<br \/>\n<a href=\"https:\/\/www.dayroma.it\/wp-content\/uploads\/2016\/03\/search.jpg\">https:\/\/www.dayroma.it\/wp-content\/uploads\/2016\/03\/search.jpg<br \/>\n<\/a><\/p>\n<p>I set from date and to date, then I click the search button but events list in tabbed page is not refreshed filtered.<\/p>\n<p>I made this custom filter through this code:<\/p>\n<pre><code>function display_custom_search( $attr, $content = null ) {\n\n\t$search_args = em_get_search_form_defaults();\n\tem_locate_template(&#039;templates\/events-search.php&#039;, true, array(&#039;args&#039;=&gt;$search_args));\n\n\t$args[&#039;limit&#039;] = !empty($args[&#039;limit&#039;]) ? $args[&#039;limit&#039;] : get_option(&#039;dbem_events_default_limit&#039;);\n\t\t\t\t\t\tif( !empty($args[&#039;ajax&#039;]) ){ echo &#039;&lt;div class=&quot;em-search-ajax&quot;&gt;&#039;; } \/\/AJAX wrapper open\n\t\t\t\t\t\tif( get_option(&#039;dbem_event_list_groupby&#039;) ){\n\t\t\t\t\t\t\tem_locate_template(&#039;templates\/events-list-grouped.php&#039;, true, array(&#039;args&#039;=&gt;$args));\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tem_locate_template(&#039;templates\/events-list.php&#039;, true, array(&#039;args&#039;=&gt;$args));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif( !empty($args[&#039;ajax&#039;]) ) echo &quot;&lt;\/div&gt;&quot;; \/\/AJAX wrapper close\n\n    \/*return &#039;&lt;a href=&quot;http:\/\/twitter.com\/filipstefansson&quot; class=&quot;twitter-button&quot;&gt;&#039; . $content . &#039;&lt;\/a&gt;&#039;;*\/\n}\nadd_shortcode(&#039;custom_search&#039;, &#039;display_custom_search&#039;);<\/code><\/pre>\n<p>If this code is wrong, how can I filter events in my home page?<\/p>\n<p>Thank you everyone<\/p>\n<p>https:\/\/wordpress.org\/plugins\/events-manager\/<\/p>\n","protected":false},"template":"","class_list":["post-7225232","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7225232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7225232\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7225232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}