You should create a custom query inside if.
if ( $total_results == 0 ) {
// Create a new query with the terms 'Find Us'
$query = new Wp_query('s=Find Us');
if ($query->have_posts()):
while ($query->have_posts()):$query->the_post();
//whatever you want to do with the result
endwhile;
endif;
wp_reset_postdata();
}
You can refer Creating a search page and Wp_query class referrence for more detail.
Related Posts:
- How do I search inside specific taxonomies in WordPress
- How to find exact match for search term in WP_Query? What is the additional string added in LIKE query in WP_Query?
- Creating a custom search for a specific post type
- Editing the default wordpress search
- Get a list of posts by specific category
- Add to search posts query array with post IDS which will appear first
- Search has query that will return no results
- WP Query – Search in title or author_name
- How to show terms from another taxonomy
- How can I modify standard search query to include also ACF custom fields values?
- Search Functionality broken by the wp 4.2 update
- Need help setting up a search form for wordpress [duplicate]
- Search query alteration not working for meta values
- Search results stuck on page 1
- Advanced Search – Is this possible?
- Can I force WP_Query to return no results?
- What is the most efficient way of querying posts based on visits and date for current day?
- When should you use wp_reset_postdata vs wp_reset_query?
- Order posts by tags count?
- Add and in the header while looping over custom query in page template
- Which custom query am I in and how can I access its properties & methods?
- How to speed up wp_query, took more 5s to run against 100k posts
- How do you query wordpress posts using a math formula between multiple meta field values?
- Get image of latest post from taxonomies/categories
- Search query – exact post title match
- Including only current user’s posts in search
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Undefined WP_Query::has_posts()?
- Custom category search box for WordPress
- Refine search results using WP_Query
- Search Posts with Custom Fields as query
- How to access a query twice in different template files?
- Minimize database queries to user tables?
- Assigning a meta_query value based on regexp to wp_query fails
- Query all published post AND attachment with specific mime type
- Get all products which have both product category
- unable to retrive parent page information
- wp_query ‘s’, search filter with pagination is not working
- How to display user order by role
- WP Query related posts by tags
- Order by summing multiple values
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- query_vars overriding WP_Query args
- how can I override The Events Calendar query modifications?
- Check if loop has any categories?
- No results found from a $wpdb->get_results() query when trying to join more than one meta key query
- Query only the posts with a post format of “audio”
- Include current post into loop
- Include post content of linked posts in search
- Prevent author bio page from showing in search results
- How do I amend wp_query before it is run/executed?
- WordPress Custom Search Form Displaying Unexpected Results
- Yoast primary category query modification
- Slow Query On Search
- How To Keep Search Title the same on paged Results
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- Write WP Query that selects posts that are part of the same two categories
- WP_User_Query orderby meta_val_num
- Filter out a meta key in the Search results page with two CPT
- WP_Query custom order and pagination
- Query by key or author
- Unable to paginate a custom page query
- Include one page/post into query which is already returning posts
- Why doesn’t my WP Meta Query return any results?
- Can I make a search query which includes a space?
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- How can I modify this code to make the search box include tags and meta
- Filter products on category AND tag
- Change search query in wordpress custom post type
- WP_Query no result if keyword contains number
- Exclude post from wp_query based on custom field boolean
- Doing $wpdb->get_results returns NULL, doing the same query in my DB returns correct value
- How to get meta key list efficiently?
- Order posts by tags count?
- Why pagination is not working with tax_query param?
- Strange results from WP_Query
- Is there a way to control both Order By and Order query parameters from one input field
- getting posts by tags
- WP_Query & Duplicate entries
- Custom Post Type WP_Query with filters and search
- return child post if available otherwise parent post
- Get posts by similar names and categories
- Query by meta value (add a dropdown of all values)
- orderby in WP_QUERY – Use the order from the Dashboard
- Query posts in current category but not attachment format
- WP_Query always returning the last custom post
- wp_query – Modify $query to include duplicate content
- Optimising specific Query with ACF meta objects
- How to get several fields from wp_query?
- Combine privileged users array with my current query
- $wp_query when new WP_Query
- Pagination not working with WP_Query (creates links but no page)
- Query custom post type by date field only working when two posts match the query
- Divide WP_Query posts by date & post type
- Query Posts by date range with fixed beginning and end
- query by meta value then date and not empty meta value
- New WordPress WP Query using posts from certain categories
- WordPress WP_Query Search (‘s’) With Multiple Search Terms
- Use value from meta key array for use in WP_Query