get_
is your friend. the_content()
already outputs the content, whereas get_the_content()
returns it (so you can check for length and decide whether to output or not).
$content = get_the_content();
if (strlen($content) > 0) {
//..
} else {
//..
}
Related Posts:
- Getting paginate_links() ‘end_size’ to display none
- What is the best practice for escaping data URIs?
- WordPress Template Engine?
- Display only text to WordPress loop without loosing the text formatting
- Where exactly do I write define( ‘WP_DEBUG’, true ) in wp-config file
- Making a follow button, Ajax not talking to php
- get understrap pagination to work with custom query
- Replace existing content from specific WooCommerce admin orders list column
- How do I get images (with a thumbnail preview) to show in search results?
- How to display blog images using wordpress in existing project
- How do I translate this string – PHP syntax question
- How to break down importing of feeds
- PHPCS: Strings should have translatable content
- mysqli_real_connect() – authentication method unknown to the client Warnings
- How to get woocommerce cart content without an action?
- php syntax – how to concatenate properly – echo bloginfo(‘stylesheet_directory)
- how to increase custom post value by one most efficiently?
- multiple if statements [closed]
- Escape post image attachments added to template
- Woocommerce product download URL
- Multiple choice in a custom taxonomy
- Echo URL of large version of Featured Image
- Get_avatar filter?
- WordPress custom login form using Ajax
- Remove price from Woocommerce variable product dropdown menu
- WP dynamic featured image – Can’t get second featured image url
- Why is my cookie not unsetting upon logout? [closed]
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?
- How to remove role=”navigation” from all nav elements?
- how to query a post based on previous page post ID
- How to use $_GET function WordPress backend
- How to set variable, pass it to a partial file and remove it after?
- wp_dropdown_pages auto submit
- WooCommerce Tabs [closed]
- Limit checklist by the current user
- How to loop through all the attached images in a post, and get their url one by one
- Use Tags to initiate Search
- Show About and Contact Us page when they’re clicked in the top menu.
- single.php with different look by category
- Displaying posts based on category
- Changing the color scheme based on the url visited
- How to send form data from WordPress (Meta Box) to an OData service?
- Pass Variables or Variable Place-Holder from Editor to PHP
- Issue with custom loop in Archive page
- WooCommerce pages looks unstyled
- class ‘wphpc_PAnD’ not found
- Accessing values from ACF sub field (flexible content area) in PHP
- Creating an image from a custom field
- home.php show blog posts as grid view
- Custom post type permalinks do not appear using the link functions
- Loading Posts & Category with Ajax
- How to organize functions.php content
- Enqueueing a code block from an options framework
- List all anchor links on a page
- Assign Custom classes to every Excerpt
- Adding a ‘style=’ bit to image_send_to_editor output
- Don’t display a sidebar widget when on a specific page
- Auto create Nextgen Gallery on post creation [closed]
- Adding a navigation page state to individual blog and portfolio pages
- Inline CSS header style priority function.php Child (no enqueing I think)
- Display Post Title From Select Choice Loop in Advanced Custom Fields (ACF) – WordPress
- Jetengine Forms – Media upload path
- excep tonly one css, don’t load any css
- is_front_page is not working in my functions.php
- Is it possible to update the dataset using update_post_meta
- Change ajax live search results
- Hide payment method based on user role AND minimum cart value
- Checkbox is not being set
- Install functionality for push notifications but WP-Theme has oddly-named, hidden source files [closed]
- Update $wpdb query with AJAX
- How to get this .php code from my theme into my plugin?
- Send Notification to all users that followed some author
- Search function not working
- loop to return tags in woocommerce in alphabetical order?
- Embedded pages by ID are not respecting Private and Draft status
- What image is this pulling?
- Adding a sidebar to wp-login.php
- add class to background image
- Adding category in wordpress – custom
- How to merge 2 WordPress sites?
- Adding header function to theme
- wordpress is_main_query() breaks
- how to register a second page-template
- Run php function after html click after page refresh
- Trying to put a search page on site
- 2 small questions: How to redirect to a created page & show that pages title in wp, bp
- Posts sortable column not sorting properly for custom field numbers
- How do I modify the with wp_nav_menu()
- The search engine of my website finds only posts and not pages, how can I solve this problem?
- How can a ‘scripts’ directory be hooked into wp_head();?
- Display Current Time using shortcode
- WP and Laravel integration (Updated) [closed]
- There’s a 0 adding to the value on multiple post type
- Add/alter image attribute before render
- How do I do so that people can register on my wordpress site?
- Custom taxonomy pagination shows 404
- footer doesn’t display
- hiddenQuestions.find is not a function
- How can I improve and optimise my wordpress web server for better performance in 2023
- Internal server error when enabling Multisite in WordPress