{"id":928423,"date":"2015-01-04T04:05:33","date_gmt":"2015-01-04T12:05:33","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/"},"modified":"2015-02-09T06:21:10","modified_gmt":"2015-02-09T14:21:10","slug":"custom-filterbar-for-filtering-countries","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/","title":{"rendered":"Custom filterbar for filtering countries"},"content":{"rendered":"<p>Hi Barry, hi Brook,<\/p>\n<p>I want to create a custom filter for filtering the events of specific countries.<\/p>\n<p>As described in this posts I created a new filter file and added a hook in the functions.php:<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"WFda2llHL5\"><p><a href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-filter-to-filter-bar\/\">Adding Custom Filter to Filter Bar<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Adding Custom Filter to Filter Bar&#8221; &#8212; \" src=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-filter-to-filter-bar\/embed\/#?secret=tNpVHUxQxp#?secret=WFda2llHL5\" data-secret=\"WFda2llHL5\" width=\"580\" height=\"327\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"qN30AwZukI\"><p><a href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-filter-to-filter-bar-2\/\">Adding Custom Filter to Filter Bar<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Adding Custom Filter to Filter Bar&#8221; &#8212; \" src=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-filter-to-filter-bar-2\/embed\/#?secret=KVo9hZvJaT#?secret=qN30AwZukI\" data-secret=\"qN30AwZukI\" width=\"580\" height=\"327\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>functions.php:<\/p>\n<pre><code>add_filter( &#039;tribe_events_all_filters_array&#039;, &#039;custom_add_filter_callback&#039; );\n\nfunction custom_add_filter_callback( $filters ) {\n    $filters[&#039;TribeEventsFilter_Country&#039;] = array(\n        &#039;name&#039; =&gt; &#039;Country&#039;,\n        &#039;type&#039; =&gt; &#039;select&#039;,\n        &#039;admin_form&#039; =&gt; &#039;Titel: &lt;input name=&quot;tribe_filter_options[country][title]&quot; value=&quot;Land&quot; type=&quot;text&quot;&gt;&#039;,\n    );\n \n    return $filters;\n}<\/code><\/pre>\n<p><strong>Question 1: <\/strong><br \/>\nWhat are the available options for type? (radio, checkbox, select?)<\/p>\n<p>lib\/filters\/TribeEventsFilter_Country.php (currently it&#8217;s only a slightly modified copy of http:\/\/pastebin.com\/30mZSeKk)<br \/>\nhttps:\/\/www.dropbox.com\/s\/9juqgeb9yyaf43q\/TribeEventsFilter_Country.php?dl=0<\/p>\n<p>The filter appears in the backend successfully:<br \/>\nhttps:\/\/www.dropbox.com\/s\/1ctz3w2nziepjq5\/Screenshot%202015-01-04%2012.55.28.png?dl=0<\/p>\n<p><strong>Question 2<\/strong><br \/>\nIn the frontend the filter doesn&#8217;t appear. Can you give a hint where the problem resides?<\/p>\n<p>Best regards,<br \/>\nOliver<\/p>\n","protected":false},"template":"","class_list":["post-928423","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>Custom filterbar for filtering countries -<\/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\/custom-filterbar-for-filtering-countries\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom filterbar for filtering countries -\" \/>\n<meta property=\"og:description\" content=\"Hi Barry, hi Brook, I want to create a custom filter for filtering the events of specific countries. As described in this posts I created a new filter file and added a hook in the functions.php: Adding Custom Filter to Filter Bar Adding Custom Filter to Filter Bar functions.php: add_filter( &#039;tribe_events_all_filters_array&#039;, &#039;custom_add_filter_callback&#039; ); function custom_add_filter_callback( [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-02-09T14:21:10+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\/custom-filterbar-for-filtering-countries\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/\",\"name\":\"Custom filterbar for filtering countries -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-01-04T12:05:33+00:00\",\"dateModified\":\"2015-02-09T14:21:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/#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\":\"Filter Bar\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/filter-bar\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Custom filterbar for filtering countries\"}]},{\"@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":"Custom filterbar for filtering countries -","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\/custom-filterbar-for-filtering-countries\/","og_locale":"en_US","og_type":"article","og_title":"Custom filterbar for filtering countries -","og_description":"Hi Barry, hi Brook, I want to create a custom filter for filtering the events of specific countries. As described in this posts I created a new filter file and added a hook in the functions.php: Adding Custom Filter to Filter Bar Adding Custom Filter to Filter Bar functions.php: add_filter( &#039;tribe_events_all_filters_array&#039;, &#039;custom_add_filter_callback&#039; ); function custom_add_filter_callback( [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/","article_modified_time":"2015-02-09T14:21:10+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\/custom-filterbar-for-filtering-countries\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/","name":"Custom filterbar for filtering countries -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-01-04T12:05:33+00:00","dateModified":"2015-02-09T14:21:10+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-filterbar-for-filtering-countries\/#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":"Filter Bar","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/filter-bar\/"},{"@type":"ListItem","position":5,"name":"Custom filterbar for filtering countries"}]},{"@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\/928423","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\/928423\/revisions"}],"predecessor-version":[{"id":928836,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/928423\/revisions\/928836"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=928423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}