if get_post_meta do something

If you mean you don’t want the <div class=”phone-num”> to appear at all, here’s how: <?php $phone_number = get_post_meta(get_the_ID(), ‘_custom_product_number_field’, true ); if ( ! empty( $phone_number ) ) : ?> <div class=”phone-num”> Phone: <?php echo $phone_number; ?> </div> <?php endif; ?>

Use inline callable for hooks and filters

When developing a WordPress Plugin that uses custom do_action and apply_filters it’s always better to use a callback function. They don’t explicitly say that you aren’t allowed to use anonymous functions but whenever you can, and when it’s appropriate, use a callback. From the plugin development docs about actions Create a callback function First, create … Read more