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
- How to *remove* a parent theme page template from a child theme?
- How to Change 404 page title
- How to disable page delete
- 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
- Search through custom post type and custom fields takes 5 minutes
- 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
- Hide page title in WordPress 3.0
- What’s the most minimal way in which a page can be hooked into WP?
- Comment filtering (search)
- Selecting An image from the Media LIbrary on the frontend
- Combine multiple words in custom meta search query
- Custom protected password page with ACF
- Page load requires a trailing “/” [closed]
- Custom search page and search by title, content and tag
- Virtual Pages plugins
- 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?
- How to change URL Custom Page?
- redirect product-category to a custom page
- Woocommerce Product page edit
- custom headers for static home page and posts page
- 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
- Show posts on a page based on a category and tag(s)
- 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
- How to get custom page template being edited in gutenberg editor
- Control Content On Non-Blog Pages
- need help with a user-specific custom page template
- Steps for custom data retrieval
- Prepopulating a specific page template with HTML/CSS
- Custom search to display results within same page
- Search widget will search everything in the site, how to limit to only search gallery name
- Best practice – pages – ACF or inline coding
- 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
- Create page as a file in my theme?
- Featured Image If Else Condition
- Search URL parameters query [duplicate]
- Create page template with some static contents
- Applying WP-cli Search & Replace to Static SQL Dump File
- Insert menu with a custom walker into page / post body using shortcode?
- How to create “custom page types” with different custom fields in them?
- WordPress archive index page
- Creating php pages in wordpress and assigning them to wordpress pages
- How to display page ids as page slug names?
- 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?
- How to Clear Empty Search values?
- How To make Custom page of every Category
- 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
- WordPress search on a custom table
- Give custom page template a custom post ID
- Adding overlay search to wordpress using add action/filter
- Use a custom page with dynamic content as a user profile page
- Product page not found if product data is set Appointment Service
- I want to embed mystream video in my wordpress site
- 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!!)
- Page with some post value id showing page not found
- Allow WP users to sort search result on a videos site