As Tom J Nowell mentioned in his comment, it is not clear what do you want to accomplish. If you want to just show your empty content div, you can use CSS as follows:
div:empty {
width: 100%;
height: 20px;
margin-bottom: 10px;
background: #ff0000;
}
It will show your empty content div as a nice, red band.
Related Posts:
- How to know if get_posts() failed?
- How to get previous 10 days post from a specific date – WP Query
- Exclude posts with empty post_content in wp_query
- Improving WP_Query for performance when random posts are ordered
- posts_per_page option limits the number of Gallery items
- Query for first 3 posts to change the look and feel
- Why posts array is empty?
- Related Posts function not working
- Show 5 posts and than 3 posts offset with pagination
- Sort / Filter Queries
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- When should you use WP_Query vs query_posts() vs get_posts()?
- How to limit the number of posts that WP_Query gets?
- Should we trust the post globals?
- Get the ID of the latest post
- How to show related posts by category
- WP_Query vs get_posts
- Random sort within an already sorted query
- How to exclude latest x posts from a paginated query?
- How to display posts by current user/author in a custom page template?
- Get posts by meta data OR title
- Query posts distinct authors
- WordPress Number of Posts Not Changing With posts_per_page
- Query only Posts from Both of Two Category?
- How to add posts to wp_query result?
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- How to get posts from a current post’s month?
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- How to get posts and comments amount per hour, per year and per month?
- While loop articles – if statement order
- Why Query is returning empty array?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Counter is skipping post when I still want it visible [closed]
- Do not show children of a category
- why the same code got different results when using query_posts in functions.php and index.php
- Display Posts with template on a Page
- How to get posts published on the latest date?
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- Post Filtering by GET URL parameters
- On what hook can I get the queried object’s final state?
- wp_query with ajax
- WP_Query: Show 10 posts in date order, first three random
- Exclude some posts from displaying in wp_query based on some condition
- Random posts that always include a particular post?
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu
- How to convert query sql to shortcode in wordpress?
- Query function not executed between element [closed]
- Echo the number of posts being displayed
- WordPress query portfolio posts
- Display 3 posts with different HTML markup using a loop
- Get posts from current category?
- Change content off every sixth element
- How Can I Always Display A Particular Post First Using WP_Query?
- How to show multiple posts thumbnail, title and date in widget
- WordPress Query – Display 5 posts (same post type), each from a given tag
- How to merge the content of posts that have the same title?
- get posts, run a custom query, and join the results
- Show posts from two specific category in WP_Query
- How to create loop of posts except post ID defined via ACF field
- Displaying all posts from other sites on the network on one site
- How to fetch courses in all languages in WordPress?
- Multisite how to display merged posts from two sites and sort by latest date?
- Fill the exclude array() in get_posts()
- filter posts based on menu_order
- wp_query args with relation
- WP_Query to get posts in a specific tag or has post_format
- Manipulate query to show specific post
- Querying posts from current category, using a variable as array argument
- Sort Events by Venue Title – Sort Post set by related post ids
- wp query custom orderby not custom field
- Ordering Posts by parent category, name ascending
- Query post category & remove any post id
- Advanced Post Display/Pagination/Ordering
- Ordering posts alphabetically by meta keys and title
- How do I control the fallback query after the original query returned cero posts?
- When should you use WP_Query vs query_posts() vs get_posts()?
- Remove duplicated posts in the loop if post has more than one category
- Retrieve latest post by multiple categories with ID
- Adding a category at even positions on main loop with modified pagination
- Query Posts From Multiple Post Types
- Displaying Results From Custom Taxonomy Query
- WP_Query retrieve custom posts but not the post showing
- How to get all post titles starting with numbers and symbols?
- wp_query select if have comments
- Creating pages and getting their values from the database table
- How to limit post query to only return a total count of items with certain post statuses?
- How to get single post by one author?
- Wp_query WooCommerce products
- posts_per_page – Repeats only first posts ‘post__in’ array
- query_posts different amount of posts per page [duplicate]
- Word count for all posts of all authors
- Sort Posts Alphabetically Based on Specific Category (Divi)
- How to show related posts by detecting the current category?
- How to make WP_Query faster when getting a post from one year ago?