$post_count
is a WP_Query
variable. You need $the_query->post_count
if( $the_query->have_posts() ): ?> <h1>Partners<h1><hr> <?php
while( $the_query->have_posts() ) :
$the_query->the_post();
if($the_query->post_count=1){
// ...
Otherwise it looks like it should work though I am not in a position to test this right now.
Related Posts:
- Loop Split two Columns
- Wp-query and column blocks
- order by numeric value for meta value
- numberposts? showposts? posts_per_page?
- $GLOBALS[‘wp_the_query’] vs global $wp_query
- Some doubts about how the main query and the custom query works in this custom theme?
- How to query posts based on lat-lng coordinate as post meta?
- Set Alias for meta_query arguments in get_posts()
- How can I use order_by to order by two meta_keys without excluding posts that don’t have those keys initialized?
- How to query only for products with status “in stock” in WooCommerce? [closed]
- WP_Query displaying ALL posts
- Does WordPress sanitize arguments to WP_Query?
- How to trigger 404 for custom query var?
- WP_Query meta_query where meta value ends in space
- Highlighting Sub topic in a post?
- wp_query for the first sticky, then display the rest of the posts excluding the first sticky
- Meta Query querrying several post types based on ACF fields is broken after update to WP 4.1
- Hide posts from users with a specific role
- How to order posts in wp_query by a meta_value of the corresponding author
- How to get sum of meta_values of a meta_key in wp_query according to conditions
- Show single post then all posts (with pagination)
- Get the post thumbnail with wp_query
- Where to use $post global variable?
- Show most popular post of last 12 months
- Multiple instances of Featured Image Query
- Refine/Filter WP_Query Posts with jQuery or Ajax
- Exclude admin from WP_Query Contributors
- Order by custom table and multiplication
- WPDB query – decrypting DB data
- Storing query variable and then using wp_reset_query
- exclude posts with a specific custom field and value
- Redirect page when URL parameter not set
- list pages using page.php and NOT page-{slug}.php
- Moving the array pointer inside a WP_Query while loop
- Help with WP_Query – Too many mySQL queries
- WordPress Pagination changes my template
- wp_query ignoring custom post_status
- Query posts(CPT, pages , hierarchical) by Ancestor ID
- How can I make WP_Query get posts that have a tag but also have random other tags?
- Input check to custom post type query
- Get a list of posts with associated meta_value
- Pagination outside of loop
- Show all data in database table and make it into an interactive table
- Combine two queries into one to use in loop
- database query with more than a couple meta hangs and doesn’t complete
- How to filter a query by date in a shortcode?
- Query post with meta value in set of values
- get_template_part causes 500 error
- Finding WordPress Posts assigned to multiple categories
- The most effective way to split by post type in custom query?
- Does meta_value (array) work with ‘orderby’?
- Get a list of posts by specific category
- Shortcode for custom query not returning results when attributes are added
- wp_query is showing posts from other categories
- Get posts in taxonomy randomly
- Page navigation doesn’t seem to work when I add offset?
- it’s possible make a WP_Query with math operations?
- is_404() – where does this get set?
- wp_query on page template not working (Genesis framework)
- Max Posts and Memory Limit
- WordPress | WP_Query does not return anything with s=a
- WP_Query Pagination
- WP_Query orderby
- Using Ajax and WP_Query to load more posts on category page fails
- I have problems with the search query using multiple post types
- How to check if logged in user have pending custom post?
- How can I re-query post_type and rewrite the url?
- Different query result on local and server
- meta_query compare > not working
- 404 page on custom search pagination
- How can I show only last year posts in wordpress archive?
- WP_Query about meta_key and its array value
- Query string order by custom field
- Paging works correctly on local version, but not live?
- I can’t get post based on its postmeta value and key
- Change database image location for transportability
- Combine Tax Archive and Meta_Query in WP_Query
- Get posts by birthday
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Paginate nested query of child posts
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Issue in If else condition [closed]
- Pagination not working with WP_QUERY
- Get Current CPT taxonomy category in shortcode
- Custom Content Slider stop duplicate
- Extract video content from post to display on front page
- Sort Posts with custom meta key by default which is currently set as optional
- wp_query pagination links producing 404
- How return normal search result using wp_ajax action for wordpress
- Custom post types loop on a page template
- Pagination problem with multiple loops on the same page
- Carousel slider with WP_Query to show 3 posts on each slide
- how to use transient method?
- WP_Query – meta fields numeric
- How to query posts from single post format on Genesis framework
- How to replecate the _fields parameter in custom REST api endpoint
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Refresh wp_query with no changes
- SQL query into to WP query
- Search results stuck on page 1