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; ?>
Related Posts:
- Can i use php sql functions instead of $wpdb?
- Why include a composer.json file with my plugin?
- Getting paginate_links() ‘end_size’ to display none
- What is the best practice for escaping data URIs?
- append PHP function to the_content
- Setting up the child theme so as to enable right-to-left WordPress?
- How to track a users progress through pages by inserting data into WordPress Database?
- How do I get content of custom post type through post ID in wordpress
- How do I get images (with a thumbnail preview) to show in search results?
- How to display blog images using wordpress in existing project
- Block PHP Files Nginx
- PHPCS: Strings should have translatable content
- mysqli_real_connect() – authentication method unknown to the client Warnings
- how to increase custom post value by one most efficiently?
- WordPress File handle – fopen, fwrite not working with $.ajax or $.post Jquery
- Do I need to prepare query before get_results(), get_row() and get_var()?
- Woocommerce product download URL
- Multiple choice in a custom taxonomy
- Calculations in functions.php [closed]
- How does the ternary operator work in the wordpress loop post?
- Get_avatar filter?
- WordPress custom login form using Ajax
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- How to store post ID’s in cookie or session to display the same posts later
- Dynamic content in template
- register_taxonomy() take much queries
- Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]
- WooCommerce Tabs [closed]
- Limit checklist by the current user
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- single.php with different look by category
- WordPress Block developer from exporting Database via PHP
- Is There A Way To Make Theme Files Accept Shortcodes?
- Is there any way to get a drop down list of time zones?
- php within html within php
- Displaying posts based on category
- Changing the color scheme based on the url visited
- Clickable image link sends people to wrong URL
- 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
- Gravatar image url is wrong?
- This function is deprecated; use mysql_real_escape_string() instead
- How to get current category
- How to organize functions.php content
- Make next post button link to random post
- Show parent categories of the current category
- Adding a ‘style=’ bit to image_send_to_editor output
- Post Views Code Hacks
- Closing WP_LINK_PAGES DIV ID w/After Argmuent
- 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
- orderby meta_value_num is not working, giving default order
- How can I modify this code to make the search box include tags and meta
- Jetengine Forms – Media upload path
- Change ajax live search results
- Show full post instead of excerpt
- Checkbox is not being set
- How do i post data to url with fields?
- Update $wpdb query with AJAX
- How to get this .php code from my theme into my plugin?
- how to add functions to my function.php using a child theme?
- Getting info about selected posts using one WP_Query
- loop to return tags in woocommerce in alphabetical order?
- How to properly escape in ternary operators – Wp Coding Standards?
- Using transients to store form notifications
- wordpress form action page not found
- PHP for loop not working as intended
- How to query a staging database?
- WordPress default contact form
- Wrapping shortcode content in a span or link
- What is the best practice for restricting a section to logged in users?
- 301 redirect from webpage to wordpress page in the same root
- add class to background image
- How to merge 2 WordPress sites?
- wordpress is_main_query() breaks
- Permission functions within wordpress
- Run php function after html click after page refresh
- Get all the contents of taxonomy and sort by term
- Gallery requires a featured image but does not show it in posts/pages
- WordPress TinyMCE Add Button To The Full Screen Mode Editor
- key( $GLOBALS[‘wp_registered_sidebars’] ) is always showing the same value
- Trying to put a search page on site
- Custom PHP-coding in MU installs
- WordPress Pages into Sections edit.php PHP hack
- 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?
- php nested IF statements to hide content (possible syntax error) [closed]
- Comment section not appearing on posts with no comments
- How to handle PHP parse errors?
- How to create a loop where loop changes every post?
- Child-theme suddenly stopped working [closed]
- metabox displaying on incorrect page
- Failed opening required in PHP
- How to Set Page Pagination Using Ajax JQuery – WordPress
- How to pass and validate nonce in custom REST routes
- Rename notifications to support [closed]
- Creating posts with php-script + csv