{"id":1138852,"date":"2016-07-12T12:52:01","date_gmt":"2016-07-12T19:52:01","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/"},"modified":"2016-07-12T12:52:01","modified_gmt":"2016-07-12T19:52:01","slug":"overwriting-plugins-default-search-template","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/","title":{"rendered":"Overwriting plugin&#039;s default search template"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I&#8217;m looking for a shove in the right direction getting custom search results from the tribe_events custom post type.<\/p>\n<p>I&#8217;m setting up a site search that breaks search results into separate tabs and is based on rewrite rules and post types, but at it&#8217;s most basic for this context is http:\/\/domain.com\/?s=connecticut&amp;post_type=tribe_events&amp;custom_search=true<\/p>\n<p>The functionality I&#8217;m aiming for is this, https:\/\/my.vertica.com\/search\/downloads\/documentation\/, where search.php always displays results (not matter the post type) and also have tabs with separate URLs so results are broken up between post types.<\/p>\n<p>The site I&#8217;m developing has rewrite rules set for post_type=post (\/search\/blog\/search-term\/), post_type=teams (\/search\/team\/search-term\/), and also looking to have it work for post_type=tribe_events (\/search\/event\/search-term\/). The results for posts and teams are great and use the default search.php template to display results, but results for events are always hitting page-events.php or index.php if page-events.php is not available. I&#8217;m passing along a query var for custom_search=true in an attempt to bypass the default events archive when the var is present.<\/p>\n<p>I only want to bypass the default events search when the query var is present on a global search but am having no luck, any insight as to how this may be doable would be very much appreciated! Please see below for how my rewrite rules are set-up, and I appreciate any help bypassing the events default search.<\/p>\n<p><code><br \/>\nadd_rewrite_rule( '^search\/team\/([^\/]*)\/page\/?([0-9]{1,})\/?$', 'index.php?post_type=team_branch&amp;s=$matches[1]&amp;pages=$matches[2]', 'top' );<br \/>\nadd_rewrite_rule( '^search\/team\/([^\/]*)\/?', 'index.php?post_type=team_branch&amp;s=$matches[1]', 'top' );<\/p>\n<p>add_rewrite_rule( '^search\/event\/([^\/]*)\/page\/?([0-9]{1,})\/?$', 'index.php?post_type=tribe_events&amp;s=$matches[1]&amp;pages=$matches[2]&amp;custom_search=true', 'top' );<br \/>\nadd_rewrite_rule( '^search\/event\/([^\/]*)\/?', 'index.php?post_type=tribe_events&amp;s=$matches[1]&amp;custom_search=true', 'top' );<\/p>\n<p>add_rewrite_rule( '^search\/blog\/([^\/]*)\/page\/?([0-9]{1,})\/?$', 'index.php?post_type=post&amp;s=$matches[1]&amp;pages=$matches[2]', 'top' );<br \/>\nadd_rewrite_rule( '^search\/blog\/([^\/]*)\/?', 'index.php?post_type=post&amp;s=$matches[1]', 'top' );<br \/>\n<\/code><\/p>\n","protected":false},"template":"","class_list":["post-1138852","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>Overwriting plugin&#039;s default search template -<\/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\/overwriting-plugins-default-search-template\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Overwriting plugin&#039;s default search template -\" \/>\n<meta property=\"og:description\" content=\"Hi, I&#8217;m looking for a shove in the right direction getting custom search results from the tribe_events custom post type. I&#8217;m setting up a site search that breaks search results into separate tabs and is based on rewrite rules and post types, but at it&#8217;s most basic for this context is http:\/\/domain.com\/?s=connecticut&amp;post_type=tribe_events&amp;custom_search=true The functionality I&#8217;m [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/\" \/>\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\/overwriting-plugins-default-search-template\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/\",\"name\":\"Overwriting plugin&#039;s default search template -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-07-12T19:52:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/#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\":\"Overwriting plugin&#039;s default search template\"}]},{\"@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":"Overwriting plugin&#039;s default search template -","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\/overwriting-plugins-default-search-template\/","og_locale":"en_US","og_type":"article","og_title":"Overwriting plugin&#039;s default search template -","og_description":"Hi, I&#8217;m looking for a shove in the right direction getting custom search results from the tribe_events custom post type. I&#8217;m setting up a site search that breaks search results into separate tabs and is based on rewrite rules and post types, but at it&#8217;s most basic for this context is http:\/\/domain.com\/?s=connecticut&amp;post_type=tribe_events&amp;custom_search=true The functionality I&#8217;m [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/","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\/overwriting-plugins-default-search-template\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/","name":"Overwriting plugin&#039;s default search template -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-07-12T19:52:01+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/overwriting-plugins-default-search-template\/#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":"Overwriting plugin&#039;s default search template"}]},{"@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\/1138852","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":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1138852\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1138852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}