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?
- How to split a loop into multiple columns
- Is it necessary to reset the query after using get_posts()?
- Get post by page name or slug
- save_post + insert_post = infinite loop
- ACF Repeater loops and resets – where is the reset_rows() documentation? [closed]
- Apply styling only to first page sticky posts
- Search results with custom loop don’t update when paged
- Adjust the results quantity for Search Results page pagination
- Load comments per post on click with AJAX
- connect last post with first post
- taxonomy tags 404 to custom post types
- How can I make the loop not count special post formats towards the post count?
- How do I order my loop query?
- Orderby my needs in foreach loop like by title or something?
- How to show posts with multiple tags on tag.php?
- Edit css for search results page
- Custom post_type search pages
- Change date format
- How to stop the continuation of posts on the second loop from where the first ended
- How do you stop the rendering of the website to have something display on the front-end?
- add_action in the loop hooks
- Reset Loop get_posts();
- Offset Loop by 1 , Limit next loop to 1 (Most Recent) Post
- How to show multiple attachements together with Scribu’s Posts 2 Posts connector?
- Simplest Way to Build Custom Archives Page?
- Database query and get_user_meta return incorrect data
- Need to while loop and display contents in the subfield of a group field given by ACF
- Set og:image programmatically in custom single post with external images
- How to display a loop of custom post types in columns
- dispaly all hierarchical post types from a taxonomy
- WordPress Modal showing posts not working properly
- Query posts and display all dates in repeater field in chronological order
- Multiple loops in set intervals with code in between
- Attachment Metadata inside of Loop
- Modify widget to output posts in custom order
- Insert/sticky multiple posts in multiple positions
- Stuck with conflicting loops on page template
- Show amount of posts created today above loop?
- How to create WordPress loop with combination of 4 and 2 columns twitter-bootstrap?
- How to add custom HTML markup and classes to the_content()?