I’m using something of the sorts for delivering some standard default text if the post content is empty. Give this a whirl:
<?php if( $post->post_content != "" ) {
//do something or show content
} else {
//do something else
}?>
Related Posts:
- Show content if parent page has children
- Current post’s author name in the author meta tag
- Conditional statement for parent, child and grandchild pages
- Trying to use Ternary operators with WP Conditionals
- When is is_admin() available?
- Check if current page is wp-admin
- Second Navigation inside header
- Using is_page() in functions.php not working at all
- Output 2 items within the Loop
- conditional statement for custom taxonomy
- How to enqueue CSS and JS only on specific template?
- how could I load a different template part by page
- WordPress, AJAX and pre_get_posts using conditional tags
- If tag equals then show else show
- Conditional statement for dates
- How can I display a div ONLY if it is not a certain term page
- Don’t show certain div on front page?
- Add class to DIV depending on page loaded
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Undefined index for default custom theme option
- Remove conditional tag from header
- Display an image based on field value
- Multidimensional Array
- “if parent category is” conditional?
- Conditional for Post Format
- conditional: if is page, and all subpages
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- page 1 is not paged
- How to add Text before my Custom Term and hide it when empty
- How can i create a function tag in my plugin
- Add code to the header of posts by particular author
- Display specific page if user signed in
- How to get Post sidebar & footer including html like get_the_content() which only gets content section?
- Widget Logic – display on page and all child
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- if user is admin display admin link and logout link else display logout only
- Add code only for blog posts
- How to define Og Meta Tags in header using conditions [duplicate]
- If Month=Particular month display content [closed]
- How to echo a different field if another field is empty?
- Adding else if conditional statement to purchased theme
- Conditional in foreach loop is outputting content twice
- Advanced custom fields Repeater conditional statement not working [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]
- if is specific custom post in cpt
- advanced custom fields: repeater field within conditional statement [closed]
- WordPress Block Editor Gutenberg running code inside ! is_admin()
- What’s the best way to use the Featured Image for responsive web design?
- Hide php Notices in Dashboard
- Using Echo in ShortCode – Stuck
- Two posts in same div – WP loop
- Compare two meta key values against each other inside the get_posts array?
- WordPress menu deletes when trying to add a hook
- How to show only a certain part of the entry title?
- Programmatically add and remove woocommerce product category
- Get image’s size name from it’s dimension
- If Query In Sidebar
- wp_enqueue_scripts leads to error
- How create a Shortcode with hover and complex options
- WordPress SQL injection
- Function returns text instead of html [closed]
- persist a variable set in header.php all the way down to footer.php
- What is the alternative code to if (isset ($_POST) && !empty ($_POST) to avoid warnings?
- Remove item in Checkout
- How to Update post_modified of all wordpress post
- echo esc_url( get_permalink($post->ID) + complete the ID’s url
- How to add a rewrite endpoint to unattached media?
- Accessing an API with jQuery and AJAX
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- Good RSS Feed Parser to use on php file?
- Obfuscate links (for SEO purpose) [closed]
- How to remove Login from in my account page
- Header is not displaying on certain pages of wordpress theme [closed]
- Retrieve the whole widget sidebar and pass it inside an html
- Configure WordPress to Use Responsive Image Rendering
- Creating multiple tables with Plugin
- How to access specific product id on other pages/posts?
- Return newly created category by code
- Meta Box clears saved field content
- Woocommerce remove menu item on myaccount dashboard
- Hook into all password resets in WordPress and get password before hashing?
- WordPress select query issue
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- woocommerce plugin bugs
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- Getting most popular posts based on Facebook comments count
- WordPress get_post_meta issue
- Woocommerce Price Text
- Display pages from specific page template
- If Elseif Query
- Querying multiple meta_keys in WordPress SQL query
- 3 domains, 1 wordpress install, redirecting and changing domains on live site
- How can I print out a single stylesheet or javascript link?
- Cannot Upload Custom Header Image into WordPress Dashboard
- Generating a number based on post ID
- Properly process a custom WP REST API request (Authenticate, Authorize + Validate)?
- Losing Session ID and sessionStorage when navigating to other domains on Multisite
- Contact form with dynamic dropdown and filter
- Product Search in search.php