Additional check in meta-value.php if empty meta key value
-
Hello,
I am working on a new site and I am using woodmart Layouts. Inside the single product layout, I used the element “product meta value” and It worked perfectly as long as the meta_key had a value. The problem that I faced was that if the meta_key that I had set in the element was empty the value and the field was still there.
So I would like to ask if it is possible in the themes > woodmart > inc > modules > layouts > wpb > shortcodes > single-product > meta-value.php to add this kind of check
$meta_value = get_post_meta( get_the_ID(), $settings['meta_key'], true );
if ( empty($meta_value) ) {
return '';
}
so that it will not display at all the div, if there is no value inside the meta_key?
Feel free to adjust the code if something is wrong or if I miss something.
Best Regards
-
This topic was modified 1 year, 5 months ago by
supp0rt. Reason: Fixed a typo
Hello,
Thank you for your suggestion. We will consider adding an option to hide empty meta values for our future updates.
Kind Regards
That’s all I wanted. I will kindly ask if this is possible to be added to the next update of the theme (version 7.4.4), as it would make me enable it and not change the file directly to add it.
None the less I understand that everyone manages their time accordingly and also their tasks. So I will leave it up to you. Thank you for your time.
Best Regards
We will consider adding this ability in our 7.5 update.
Kind Regards
Thank you. You may close this ticket.
Best Regards
The topic ‘Additional check in meta-value.php if empty meta key value’ is closed to new replies.