Now, is it possible to check if page is the search page
is_search()
AND what’s the search string
is_search() AND print get_query_var( 's' )
AND how many posts were found?
is_search() AND print $GLOBALS['wp_query']->number_posts()
… or if you got a custom query…
$my_query = new WP_Query( array( /* whatever args */ ) );
is_search() AND print $my_query->number_posts()
Related Posts:
- How do I set the Stewart Search Template to return only published posts in the result
- Jquery Slider for profile template
- if ( is_home() && ! is_front_page() )
- A search for ‘0’ returns results
- Is including the loop necessary for page.php? [duplicate]
- What is best way passing variables to theme templates and using them different places like widgets?
- If No Search Results, Show Posts from Alternate Search Query
- Page template not displaying
- Loop through pages with specific template
- Custom search form to display users only
- How to get_template_part using AJAX?
- wp alchemy multiple image uploader output images to template
- How to get an array of years from all of the search results, and use it to filter by year the paginated loop?
- code suddenly appearing from my tempate second loop
- How to go about combining dropdowns / filter queries?
- WordPress Loop inside Loop?
- Template structure
- How to show “teaser” posts on blog / archive pages, otherwise full posts
- Order archive results by post id in custom taxonomy template
- Filter the_posts doesn’t work on search page
- Default ‘post’ post type archive slug?
- How do I make a variable available inside partials?
- WordPress Blog has an infinite redirect loop
- 404 Template customization | Want 10 recent Post on the 404.php error page apart from the error Notice
- How to modify search.php to not show pages only show posts
- Include future posts in tags and in search
- Second Loop Showing Only One Post on Single Post Page
- How do I put my frontpage featured image in a page template for home.php?
- Get markup for post without loading into the template
- How to render the single post template with the post name?
- excerpt not showing up
- Search page loop banner image issue
- new custom theme – posts displaying on top of one another
- Does search.php autofilter The Loop?
- How do i create a list-posts-page?
- How to sort a loop after most viewed
- How to loop specific Category menu from archive page?
- Is it possible to set archive.php instead of index.php to display blog?
- Using is_page_template inside loop
- Trying to get all links in my posts
- is it bad to copy the loop for a template?
- Is “the loop” a template tag?
- Work arounds for conditional checks inside the loop in search.php?
- Deeply Nested Menu Loop with Twig using Timber [closed]
- Search – Check if post is a page on search page
- WordPress with woocommerce custom query
- Alternative layout the loop
- Cant pull in featured Image
- Template included with plugin doesn’t return all posts for custom taxonomy
- Creating a archive for taxonomy terms, not the term results
- Secondary loop cuts off at 10 posts?
- Need a conditional to test if title of parent page matches title of child page
- Building theme so user can change header image [closed]
- get all page templates
- Load featured article once in a loop
- wordpress showing all posts instead of date range
- How to implement template file and the loop
- Eliminate duplicates in a foreach loop [closed]
- Same posts within a paginated page
- How can I create an entirely new, separate display of posts?
- Different date time in results of search
- Accessing download link from the loop with WP Download Manager Pro
- How to add “NEW” badge on latest posts or published 3 days interval
- Submit form for loop of products of the term with AJAX
- Only Show Excerpt After First 3 Posts
- Search button click sends to single-custom_post_type instead staying at the same page
- Add all category as classes in foreach loop
- How to get all multi-select user meta values and add them to an array?
- Duplicate posts on archive page
- get_posts changes main query
- Exclude posts from loop by term
- Trying to get property ‘post_content’ of non-object
- post_type incorrect for custom post type
- Bootstrap tabs are not being clicked in WordPress loop
- Get gallery in loop through ajax
- Archive: Lists itself
- Set og:image programmatically in custom single post with external images
- How to show the last article in a different way in my blog?
- Last post in loop when even
- Get a specific size from wp_get_attachment_image_src
- the loop printing post in one grid
- Check value of post meta within IF statement
- How to insert content before pagination in loop?
- Pagination on a underscore custom theme
- My WordPress installation doesn’t load correct template
- How to display a loop of custom post types in columns
- Use the loop to check if DB record exists?
- Build a Page which shows the Oldest Post with specific Custom Field Value
- WordPress multiple loops with default pagination
- Loop random posts and display odd and even based on two alternating meta values?
- How to resolve a reload loop issue in the frontend when logged in to WordPress multi-site backend admin area
- Can’t limit posts_per_page in loop
- More than one search results page template for two searches on site
- WordPress loop : how to exclude some posts with their status?
- WordPress + Isotope: how to give different widths to each entry?
- Exclude Posts Using Meta Query and User Meta
- Customizer settings using “for” loop
- I want to load post in bootstrap Modal dynamically
- hide woocommerce tab if empty
- Custom taxonomy template for custom fields loop [closed]