do_shortcode()
returns content with shortcodes filtered out. We can check the return value and display appropriate message accordingly.
$output = do_shortcode( '[picu_list_collections email="' . $current_user->user_email . '"]' );
// the shortcode returns an empty <ul> tag, if there is no gallery
// https://plugins.trac.wordpress.org/browser/picu/trunk/frontend/includes/picu-template-functions.php#L464
if($output == '<ul class="picu-collection-list"></ul>') echo "Nothing here";
else echo $output;
I hope this may help!
References:
Related Posts:
- Retrieve multiple values passed to a single attribute in a shortcode
- Loading page template into shortcode
- My shortcode is showing up twice
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- Making Quote Plugin more efficient
- custom shortcode will not display the wrapped content
- Append HTML Using Shortcode
- Plugin CSS not enqueing
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- WordPress shortcode returns the data before
- Action Hook Inside WordPress Plugin Shortcode
- What is the difference between Null vs Empty (Zero Length) string?
- How to Create custom block for displaying information in content section which act like shortcode
- Display a custom name when the user has no name settle in his account
- overwrite wordpress gallery with custom gallery shortcode
- How to return html as a string from php for WordPress
- Shortcode Works for Logged in Users but Not Working for Guest
- using a shortcode in a hyperlink
- WP Custom tables query
- Custom plugin with shortcode not working
- Prevent multiple counts by same user – WP PostViews plugin
- Second select list values are not saved after clicking update
- Use wc_enqueue_js only on specific pages – nested add_action
- Creating a WordPress shortcode
- has_shortcode() – how to detect nested shortcode
- Theme url in all plugin pages
- How to access function from outside of a class within this class in WP plugin?
- How can i display post loop in table format?
- Placing raw HTML inside a WordPress shortcode
- PHP can I add line numbers to file_get_contents()
- How to display posts by current user in a drop down
- what is the best practice to add new field to an api route
- Use custom post type for a store locator
- Colon is Missing In My Website Url in WordPress
- WP CRON duplicate wp_insert_post with has < and > tag
- How to send Ajax request from my plugin in admin dashboard?
- AJAX success response is not working but it’s saving my changes
- Best practice for show data to one specific user?
- Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
- Asynchronous multiple requests 401 Unauthorized
- get_posts works in the page template but not in a shortcode
- How can I include shortcodes within PHP?
- Using data sent via AJAX in multiple functions on a WP plugin
- What does -> mean in WordPress?
- Syntax error in a shortcode function
- Change product_base programmatically
- How to add the sidebar to all the pages except the home page? [closed]
- Short code template + ajax
- Plugin development and composer
- Set default Database Storage Engine when creating tables with plugins?
- custom post type with role Vendor
- Shortcode for a Series of Elevating Image Files, Excluding a Range?
- Shortcode won’t execute
- Execute Jquery when a specific page in my plugin is loading
- AJAX function not working [closed]
- Can ‘Custom Field’ data be inserted into this Short Code?
- Set document title through shortcode plugin
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- WordPress can’t use ZipArchive
- How to change basename url for wp-admin?
- How do I reopen the (Popup Maker) after entering the correct password for a password protected page?
- Not able to remove caption shortcode from the content
- Only the first image uploads
- WordPress loading progess – wp-blog-header.php
- Illegal string offset checkbox
- Custom plugin: how do I call a PHP file if settings option is set to true?
- Trying to use a variable to set image width
- Shortcodes not processing inside post content
- Gravity Forms: How to add PHP function to confirmation conditional shortcode?
- wpdb->query returns different value to phpMyAdmin
- wp_update_post gives 500 internal error
- How to identify which php file a plugin is using on page load?
- dashboard widget form not submit mails
- I want to hide “sold by” on certain pages with id page 43
- register_setting not save checkbox
- How to add a PHP scripts into WordPress
- How does one make a URL return dynamic JSON with custom Content Type?
- How to give custom roles the capability to edit one Menu instead of every Menu
- Multiple Arrays for Custom Post Query using Boostrap accordions and ACF repeater fields
- Replacing entire tag with shortcode – JavaScript [duplicate]
- Shortcode just with a php code
- add menu page in loop menu order
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- widget: input the px value from user and use it as inline style in widget function
- Custom post type single page return to listing page
- Contact form field in wordpress menu
- php string inside shortcode does not work
- Limit the number of successful logins
- Shortcodes (with a space) added to php Sample
- How can I put a custom field as the link of a button shortcode?
- WordPress rewrite question
- Using Nonce for my Form
- Create new folder and upload files to custom folder via wp_handle_upload
- Problem using explode inside add_shortcode() callback funciton [closed]
- SHARING TO FACEBOOK – FROM DYNAMICALLY GENERATED PAGE
- Display Current Time using shortcode
- How to create shortcode of this PHP code
- Login user into magento using wordpress account
- Redirect loop upon installation of my plugin
- Customize create table SQL statement in any WordPress plugin