{"id":1086583,"date":"2016-03-09T03:53:27","date_gmt":"2016-03-09T11:53:27","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/"},"modified":"2016-03-25T09:35:08","modified_gmt":"2016-03-25T16:35:08","slug":"add-a-custom-filter","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/","title":{"rendered":"Add a custom filter"},"content":{"rendered":"<p>Hello,<\/p>\n<p>I&#8217;m trying to add a custom filter (EventCountry) in my FilterBar.<br \/>\nI found some threads but they are not helping. All of them are outdated (3.X) though.<\/p>\n<p>What I did so far:<br \/>\n\/src\/Tribe\/Filters\/Venue.php has been duplicated in Country.php<br \/>\nClass name has been changed accordingly. I change the meta_key occurences in SQLs to &#8220;_VenueCountry&#8221;.<\/p>\n<p>In functions.php : <\/p>\n<pre><code>add_filter( &#039;tribe_events_all_filters_array&#039;, &#039;custom_add_filter_callback&#039; );\nfunction custom_add_filter_callback( $filters ) {\n    $filters[&#039;Country&#039;] = array(\n        &#039;name&#039; =&gt; &#039;Country&#039;,\n        &#039;type&#039; =&gt; &#039;select&#039;,\n    );\n    return $filters;\n}<\/code><\/pre>\n<p>This add a new filter in admin area. I don&#8217;t know what to specify in admin_form. This should call that function in Country.php but it actually doesn&#8217;t.<\/p>\n<p><code>new Tribe__Events__Filterbar__Filters__Country( sprintf( __( &#039;%s Country&#039;, &#039;tribe-events-filter-view&#039; ), tribe_get_event_label_singular() ), &#039;country&#039; );<\/code><br \/>\nPlaced in my functions.php, this adds automatically an &#8220;Events Country&#8221; on the right side in admin filterbar area.<br \/>\nAdmin Form is loaded but Parameters like Title and so on aren&#8217;t saved.<\/p>\n<p>None of those two ways will display anything on the front end.<\/p>\n<p>Can you point me to a solution ?<\/p>\n<p>Thanks<\/p>\n","protected":false},"template":"","class_list":["post-1086583","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>Add a custom filter -<\/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\/add-a-custom-filter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add a custom filter -\" \/>\n<meta property=\"og:description\" content=\"Hello, I&#8217;m trying to add a custom filter (EventCountry) in my FilterBar. I found some threads but they are not helping. All of them are outdated (3.X) though. What I did so far: \/src\/Tribe\/Filters\/Venue.php has been duplicated in Country.php Class name has been changed accordingly. I change the meta_key occurences in SQLs to &#8220;_VenueCountry&#8221;. In [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-03-25T16:35:08+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\/add-a-custom-filter\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/\",\"name\":\"Add a custom filter -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-03-09T11:53:27+00:00\",\"dateModified\":\"2016-03-25T16:35:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/#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\":\"Add a custom filter\"}]},{\"@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":"Add a custom filter -","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\/add-a-custom-filter\/","og_locale":"en_US","og_type":"article","og_title":"Add a custom filter -","og_description":"Hello, I&#8217;m trying to add a custom filter (EventCountry) in my FilterBar. I found some threads but they are not helping. All of them are outdated (3.X) though. What I did so far: \/src\/Tribe\/Filters\/Venue.php has been duplicated in Country.php Class name has been changed accordingly. I change the meta_key occurences in SQLs to &#8220;_VenueCountry&#8221;. In [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/","article_modified_time":"2016-03-25T16:35:08+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\/add-a-custom-filter\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/","name":"Add a custom filter -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-03-09T11:53:27+00:00","dateModified":"2016-03-25T16:35:08+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-a-custom-filter\/#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":"Add a custom filter"}]},{"@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\/1086583","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\/1086583\/revisions"}],"predecessor-version":[{"id":1087409,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1086583\/revisions\/1087409"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1086583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}