you dont need extra queries, all you would need is to sort the search results by post type. you can find a way to do so here.
and then, inside your search.php template, you would need to check for the post-types and act accodringly..
while (have_posts()) : the_post();
$post_type = get_post_field( 'post_type', get_the_ID() );
if ( $post_type === 'anime' ) :
//load a template or place your code here
get_template_part( 'template-parts/content', 'my-super-anime-template' );
//this example would load /your-theme/template-parts/content-my-super-anime-template.php
else :
//or pass a variable
get_template_part( 'template-parts/content', $post_type );
//this example would load /your-theme/template-parts/content-post.php
endif;
endwhile;
Related Posts:
- custom meta box for page default template
- How to hook up search results page to a back-end page?
- Add a searchbox to the body of a page
- Custom Same Page Search
- change top banner content on specific page
- Page template with custom html fields inside a content
- How can I make a search term redirect to a page
- get_pages() not ordering as it should
- How to redirect WordPress home page to custom static HTML page
- How can I create an alternative home page?
- Editing the Number at the end of Page URLs / Editing Page Slugs
- Creating search form for custom database table
- Pagination Help on Crazy Custom Authors Page
- page_template toggle between 2 templates + 2 permalinks for same post
- Create subpage /user/ or /my-profile/ like /author/ with additional query like /user/user123
- Customise search form in the Widget
- What’s the most minimal way in which a page can be hooked into WP?
- Comment filtering (search)
- Combine multiple words in custom meta search query
- Custom protected password page with ACF
- Page load requires a trailing “/” [closed]
- Programmatically add a custom page/path/url/route to WordPress
- What is the most idiomatic way to let clients edit phrases in HTML?
- How to merge all my pages into one, while keeping a menu bar?
- How do I deque the default stylesheet?
- Woocommerce Product page edit
- Custom page template not working
- For custom templates, is it better to use `template_include` or `type_template`?
- Search a post using the date it was posted
- Setting custom search engine indexing for a “dynamic WordPress page” with htaccess
- Split Conference WordPress Page in different years
- Custom URL going to 404
- Search result page redirect ex.com/?s=searchterms to ex.com/searchterms
- Add google org chart to wordpress page
- Javascript Solution Remove Specific Tag but leave the rest in a specific DIV
- Hi, I wanted to make custom search with multiple fields
- Control Content On Non-Blog Pages
- need help with a user-specific custom page template
- Custom search to display results within same page
- Search widget will search everything in the site, how to limit to only search gallery name
- How to structure model showcase
- Admin search post meta
- List top 5 authors with most posts
- How To Load an HTML File As A WordPress Page (With No 301/No Redirect)
- How to customize
- Custom Search on Custom Page while preserving the main search function
- Custom Loop Query For Search Page
- Featured Image If Else Condition
- Create page template with some static contents
- Applying WP-cli Search & Replace to Static SQL Dump File
- How to create “custom page types” with different custom fields in them?
- WordPress archive index page
- How to create custom layouts and static pages in themes for clients
- How to make the Pages in WordPress Customized?
- Creating custom page template
- How to create a custom WordPress front page
- Change Site Logo or Menu Logo Per Page
- How to add page content into another page
- How to Add Additional Search Button?
- How to set up conditionals in page templates?
- Remove Sidebars from page
- What would causes search to return incorrect results?
- Display a specified content on a Page and all its child pages
- WP Search Form Query: Add Author’s posts into search query
- Adding overlay search to wordpress using add action/filter
- Use a custom page with dynamic content as a user profile page
- Swap home page based on user role, Elementor layout breaking
- Taxonomy template is not reading
- New Page/Post Screen Opens an Existing Post
- Static Page, need Last and Next links at the bottom
- How can I create a Custom Page? (not a page template!!)
- Allow WP users to sort search result on a videos site
- WP_User_Query Search Multiple Keywords from a Multi-Select Field?
- Displaying posts inside table having issues
- Custom dropdown search form that allows users to select option B based from Option 1
- Custom stylesheet not loading
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- Redirect Every Instance of The Author Template Pages to Custom Author Pages
- Allow arbitrary text after page URL
- Creating a search with tag variable also added for more detailed results
- Best way to create a page outside of the pages list
- Two searchforms with different categories/posts per page
- Search a meta field for a value in all posts
- Adding pages to the Admin panel
- Custom single page based on which custom page template is selected
- How to duplicate “Pages” section in the control panel?
- Setting Custom WordPress “Posts page” AS “Front page”
- Make a custom URL and link to custom Template
- Custom search by several options send on form not works
- Search results load individual post in slide out div
- Single page template
- Adding page Title in a custom coded page
- Custom Search Results Page
- Create a custom search for Estate Agency WordPress site
- how to add a page
- use another theme for just one page
- How to apply styles to the custom page template
- Sort Search Results in Order of/by Character @ count (9) of post(s) title. (Ocean-WP theme)
- Custom CSS working on home page but not on NEW created PAGE
- Create a page for each database table entries