You have to list the keys of the meta fields saved in the metabox, because their is no function to dynamically retrieve all the fields saved in specific metabox. For example:
$store_openingtimes_keys = array(
'_cmb_open_monday', '_cmb_open_tuesday', '_cmb_open_wednesday', '_cmb_open_thursday',
'_cmb_open_friday', '_cmb_open_saturday', '_cmb_open_sunday'
);
// all the not empty meta for the post
$meta = array_filter( get_post_custom($post->ID) );
// there are any not empty meta that is one of the store opening times?
$times_meta = array_intersect( array_keys($meta), $store_openingtimes_keys );
if ( ! empty($times_meta) ) { // if so, show content
echo $content;
}
Related Posts:
- What is the index [0] for on post meta fields?
- Custom field metabox not showing in back-end
- How to hide meta box values from custom fields list?
- Create meta boxes that don’t show in custom fields
- Custom fields to save multiple values
- wp_handle_upload error “Specified file failed upload test” but still creates attachment?
- Create Multiple File Upload Metabox in WordPress
- Button inside Custom Meta Box triggering the Update Button
- Why is my Custom Meta Box Field Inputs NOT saving?
- get_posts in meta box dropdown not showing latest posts
- How can you include custom post meta in search without calling each key?
- Display Custom Meta Box Field Only If Value is Present
- shortcode in a custom metabox
- Problem with saving large amount of data in postmeta/usermeta
- Move Title and the Content WYSIWYG editor position
- How to validate select field in post meta?
- How to use media upload on metabox post page without breaking TinyMCE?
- Let’s Create Custom Field Template Documentation
- How add multiple wp_editor_box to new post
- Can I save post meta programatically without setting metaboxes?
- Meta box values are displayed on Custom Fields list. Is it possible to hide them?
- put saved metabox values back into fields and then display on the front end
- How to improve my non-unique metadata MySQL entries?
- Set class if a meta value is set within post archive
- WordPress Blocks, setAttributes not saving
- Allow HTML in Custom Metabox area
- Custom field metabox not showing in back-end
- Save, update, get and sanitize post meta as HTML not plain
- Create Meta boxes dynamically
- Get meta value when the page is a blog archive
- Can’t save meta field value if the title not set
- Display Data From This Custom Media Upload Meta Box?
- When post is updated, custom metadata in text area field is overwritten
- wp_postmeta are updated for only one page
- When editing a post with a custom meta box the values aren’t displaying correctly
- How to add new Metadata options (Date, Author, etc.) for Posts?
- Saving multiple custom meta box fields
- Best way to programmatically remove a category/term from a post
- add meta box – custom field : which to choose?
- How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
- display specific custom fields
- Add custom option to Standard Page Attributes Meta Box
- Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
- importing data from non-wordpress mysql db
- Transients vs CRON +Custom Fields: Caching Data Per Post
- Unable to save datetime custom meta field using update_post_meta() function
- Create custom field on post draft or publish?
- get_post_meta fields don’t show up on posts page
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- Add a post meta key and value only if it does not exist on the post
- Adding a custom field or metabox to the post-thumbnail widget?
- Function to change meta value in database for each post
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Get aggregate list of all custom fields for entire blog
- Woocommerce with metabox plugin
- using multiple meta_key and meta_value in query_posts
- How to check for specific meta box value on front end and output accordingly
- MySQL Query that looks for post with Custom Field, then changes Category
- ACF: How to get the full field name (meta_key) by a field key?
- How Meta Data is different from Custom Fields of POST/PAGE in WordPress
- Tweak Meta for Post to work it for Pages also
- How to add a new meta key and assign timestamp to posts
- Should custom meta boxes be able to output shortcodes the same as WordPress’ native post editor?
- Read / Watch / Listen times – meta
- Custom Meta Box (SELECT) Not Saving
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- Displaying multiple URLs as custom field values
- Stop sending email everytime I updates my post
- Best way to store everyday post views?
- Unable to get specific value from post meta
- create custom meta box with default value
- Custom meta is not being saved
- IF Custom field value equals ZERO
- Branch made by several custom values
- WordPress creates new lines in postmeta table on post update
- User customising position of WordPress Featured Image
- Insert image into sub-field with update_post_meta
- How to use conditional statement with custom field
- Custom meta boxes not saving
- Get meta field value of all catgories
- Create a new custom field for all posts based on current custom field
- Add a meta field to the list of results for a custom post type
- Display Meta Data with HTML?
- How to store meta field values
- Group Posts By Custom Meta Value: Date
- Meta field bulk editing no longer working in WP 6.0 [closed]
- Using Customizer API vs Custom Meta Box for custom content
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- Metabox/Custom fields are not saving input data
- WordPress admin area: select box with 12.000+ options
- Update custom table on metabox POST
- how to modify a field’s size in a metabox : ROWS height, and scroll control?
- Saved Post Meta Array Returns as String
- Problem saving meta data
- change attachment custom field onChange event
- Custom Meta Boxes and Fields for WordPress: Change directory upload based on user-edit page
- added a meta box to post however when saving menu while debug on throws a warning
- Make Custom Fields Public in JSON – API
- Order by a meta field in query loop