{"id":948216,"date":"2015-03-13T11:27:30","date_gmt":"2015-03-13T18:27:30","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/"},"modified":"2015-03-17T06:47:48","modified_gmt":"2015-03-17T13:47:48","slug":"filter-by-advanced-custom-field","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/","title":{"rendered":"Filter by advanced custom field."},"content":{"rendered":"<p>Hi there!<br \/>\nFirst, thank you for this amazing Calendar.<\/p>\n<p>I tried to search in the forum before asking.. trying to see if there were similar questions.<br \/>\nI found something, but it didn&#8217;t work.<\/p>\n<p>So I would like to ask you if you can guide in the right direction.<br \/>\nI am aware you can&#8217;t give so much support for the &#8220;free&#8221; users.. but it worth a try. \ud83d\ude42<\/p>\n<p>I need to have a page, which I can filter the results by the content of a custom field (created with ACF).<br \/>\nfor example using a dynamic address like : www.mydomain.com\/events\/?when=Summer<br \/>\nwhere &#8220;when&#8221; is my custom field value.<br \/>\nOn the calendar admin side, when I create the events, I have the custom field &#8220;season&#8221;, and it&#8217;s a text-area, where I insert these keywords.<br \/>\nSometime in that field is present more than a season, separated by coma. (Summer, Winter)<\/p>\n<p>At the moment I have used this code :<\/p>\n<pre><code>&lt;?php \n\n\/\/ args\n$value = $_GET[&#039;when&#039;]; \/\/ get value of selected choice.\n$args = array(\n\t&#039;post_type&#039; =&gt; &#039;tribe_events&#039;,\n    &#039;posts_per_page&#039;\t=&gt; -1,\n\t&#039;meta_key&#039; =&gt; &#039;season&#039;,\n\t&#039;meta_value&#039; =&gt; $value\n);\n\n\/\/ get results\n$show_events = new WP_Query( $args );\n?&gt;\n\n&lt;?php\n\nif( $show_events-&gt;have_posts() ): ?&gt;\n\t&lt;ul&gt;\n\t&lt;?php while ( $show_events-&gt;have_posts() ) : $show_events-&gt;the_post(); ?&gt;\n\t\t&lt;li&gt;\n\t\t\t&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;\/a&gt;&lt;?php echo tribe_events_event_schedule_details( $event_id, &#039;&lt;p&gt;&#039;, &#039;&lt;\/p&gt;&#039;); ?&gt;\n\t\t&lt;\/li&gt;\n\t&lt;?php endwhile; ?&gt;\n\t&lt;\/ul&gt;\n&lt;?php endif; ?&gt;\n\n&lt;?php wp_reset_query(); ?&gt;\n<\/code><\/pre>\n<p>Now, it returns a LOT of events.. but totally ignoring my [ ?when= ].. and the start-event is totally messed up.<\/p>\n<p>This was my target.<\/p>\n<p>The plan B is to use your LIST event page.. with some modifications..<br \/>\nBut.. How can I filter your page using [ ?when= ] ?<\/p>\n<p>For me it&#8217;s totally same.. plan A or B..<br \/>\nPlan B actually will work better.. because it&#8217;s written by you guys.. \ud83d\ude42<br \/>\nAnd I don&#8217;t have to implement pagination..order&#8230; etc etc..<\/p>\n<p>Thank you!<br \/>\nJoe.<\/p>\n","protected":false},"template":"","class_list":["post-948216","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>Filter by advanced custom field. -<\/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\/filter-by-advanced-custom-field\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Filter by advanced custom field. -\" \/>\n<meta property=\"og:description\" content=\"Hi there! First, thank you for this amazing Calendar. I tried to search in the forum before asking.. trying to see if there were similar questions. I found something, but it didn&#8217;t work. So I would like to ask you if you can guide in the right direction. I am aware you can&#8217;t give so [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-03-17T13:47:48+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\/filter-by-advanced-custom-field\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/\",\"name\":\"Filter by advanced custom field. -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-03-13T18:27:30+00:00\",\"dateModified\":\"2015-03-17T13:47:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/#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\":\"Welcome!\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Pre-Sales Questions\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Filter by advanced custom field.\"}]},{\"@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":"Filter by advanced custom field. -","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\/filter-by-advanced-custom-field\/","og_locale":"en_US","og_type":"article","og_title":"Filter by advanced custom field. -","og_description":"Hi there! First, thank you for this amazing Calendar. I tried to search in the forum before asking.. trying to see if there were similar questions. I found something, but it didn&#8217;t work. So I would like to ask you if you can guide in the right direction. I am aware you can&#8217;t give so [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/","article_modified_time":"2015-03-17T13:47:48+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\/filter-by-advanced-custom-field\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/","name":"Filter by advanced custom field. -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-03-13T18:27:30+00:00","dateModified":"2015-03-17T13:47:48+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/filter-by-advanced-custom-field\/#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":"Welcome!","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/"},{"@type":"ListItem","position":4,"name":"Pre-Sales Questions","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/"},{"@type":"ListItem","position":5,"name":"Filter by advanced custom field."}]},{"@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\/948216","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\/948216\/revisions"}],"predecessor-version":[{"id":948253,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/948216\/revisions\/948253"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=948216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}