Home › Forums › Calendar Products › Events Calendar PRO › Overwriting plugin's default search template
- This topic has 3 replies, 4 voices, and was last updated 9 years, 9 months ago by
Aaron Ware.
-
AuthorPosts
-
July 12, 2016 at 12:52 pm #1138852
Aaron Ware
ParticipantHi,
I’m looking for a shove in the right direction getting custom search results from the tribe_events custom post type.
I’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’s most basic for this context is http://domain.com/?s=connecticut&post_type=tribe_events&custom_search=true
The functionality I’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.
The site I’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’m passing along a query var for custom_search=true in an attempt to bypass the default events archive when the var is present.
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.
add_rewrite_rule( '^search/team/([^/]*)/page/?([0-9]{1,})/?$', 'index.php?post_type=team_branch&s=$matches[1]&pages=$matches[2]', 'top' );
add_rewrite_rule( '^search/team/([^/]*)/?', 'index.php?post_type=team_branch&s=$matches[1]', 'top' );add_rewrite_rule( '^search/event/([^/]*)/page/?([0-9]{1,})/?$', 'index.php?post_type=tribe_events&s=$matches[1]&pages=$matches[2]&custom_search=true', 'top' );
add_rewrite_rule( '^search/event/([^/]*)/?', 'index.php?post_type=tribe_events&s=$matches[1]&custom_search=true', 'top' );add_rewrite_rule( '^search/blog/([^/]*)/page/?([0-9]{1,})/?$', 'index.php?post_type=post&s=$matches[1]&pages=$matches[2]', 'top' );
add_rewrite_rule( '^search/blog/([^/]*)/?', 'index.php?post_type=post&s=$matches[1]', 'top' );
July 13, 2016 at 9:52 am #1139243Cliff
MemberHi. Thanks for your detailed question.
You might want to look into this file: https://github.com/moderntribe/the-events-calendar/blob/4.2.2/src/Tribe/Query.php, possibly for tribe-bar-search
I hope this helps, but please know we’re limited in helping with customizations, per our Scope of Support / Terms.
Please let me know if you get things sorted.
August 4, 2016 at 9:35 am #1147609Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Overwriting plugin's default search template’ is closed to new replies.
