You are using get_post_meta incorrectly, so it is returning FALSE every time. As PHP equates ‘0’ and FALSE, your div will always be displayed.
The correct syntax for get_post_meta is:
<?php $meta_values = get_post_meta($post_id, $key, $single); ?>
where $post_id is the only required argument.
Related Posts:
- How to break meta values into different items and avoid duplicates?
- How to wrap meta values seperated by comma in ? [closed]
- Run a check for multiple meta key values
- How to create a shortcode to print specific values stored in a post meta array?
- shortcode in a custom metabox
- Update post meta custom field using block editor
- Set class if a meta value is set within post archive
- Create Shortcode shows only posts with custom_field meta
- Using ACF Custom Field value in a URL with do_shortcode() [closed]
- Custom Field: Display only if a specific key is selected outside the loop
- Display meta data from a custom field within plugin Category Grid View Gallery
- Retrieving custom field as shortcode
- WP Query Args – search by meta_key or title
- Saving multiple custom meta box fields
- get Custom field label (select/dropdown) on front end
- Block Editor – Meta values not saved, meta changes to empty array on update
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Max length of meta_value
- How to get custom post meta using REST API
- Using get_post_meta with new_to_publish
- explode array within shortcode
- Can I count the number of users matching a value in a multiple value key?
- Auto sort the wp-admin post list by a meta key
- Update all posts automatically when using post_meta
- Get updated meta data after save_post hook
- ajax delete value from custom field array
- Custom field for default gallery
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How to display Meta Field Value?
- How do I use wp_query for WordPress search?
- Nav Menu – Add class based on meta keys
- What WordPress function to use to get meta value by using meta keys?
- Removing link ” from ” on meta_value in custom feilds
- Add custom field to all posts in specific post_type
- Button inside Custom Meta Box triggering the Update Button
- How to load an assets based on custom field value?
- Custom WP_Query for WordPress Search Results with meta_query
- Unique meta_key with array value vs repeated meta_key with single values
- Custom Field 101
- custom field (video/audio url) and embed functionality
- Allow only one post with specific meta value
- wordpress custom loop ascending descending posts by custom field
- How to validate select field in post meta?
- How to display childrens custom fields?
- how to display custom fields of post on a web page
- How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)
- How to fill custom fields with brackets in their key with add_post_meta()?
- Function that replaces the image in the absence of the post meta
- change order of images attached to post
- how can I show name and value of Custom Fields together?
- Enable a short code in the custom meta field
- Gravity Forms Update post meta from template [closed]
- put saved metabox values back into fields and then display on the front end
- How to use shortcode inside of shortcode in theme
- How to get custom image field of specific post id
- wordpress multi user question
- How to change text color depending on the number value (Using javascript)
- How can I change author of posts to the value of one of the custom field of the posts?
- get posts based on non-single metadata
- Adding Custom Metadata to my Archive/Posts page
- How to improve my non-unique metadata MySQL entries?
- Saving Custom Field that includes Quotation marks
- how can i show WordPress custom field data to my short code?
- Custom Fields Not Showing (ACF not installed)
- Post meta data not showing in frontend, until hitting ‘update’ button
- searching by keywords in post’s metas or pagination links problem
- How do I update custom field post meta in frontend post template?
- How to Find List of Available Custom Fields for Theme?
- update meta field value after
- Custom Fields Not Working In Footer
- PHP and Shortcode Combination
- ACF plugin and field update
- Retrieving Advanced Custom Field within Shortcode Function [closed]
- Echo out custom fields in comments
- Search one custom field?
- Can’t save meta field value if the title not set
- Display Data From This Custom Media Upload Meta Box?
- Save values generated via API as custom meta fields
- Sorting Posts with meta value not working
- Adding custom fields to images
- How to save dynamically generated value in post type?
- update_post_meta not working in action hook
- how to show this part only in the single post page?
- Custom field in a shortcode?
- Insert wp gallery shortcode into custom textarea
- Parse Shortcodes in Theme’s Custom Field?
- Insert shortcode before and after a list automatically
- If post custom meta data is not set, show normal state
- How do i output images from URL’s added to the same custom field key
- How to include custom field in shortcode (do_shortcode) in theme file
- Display a list of posts whose meta field values are equal to the ID of the post being viewed?
- custom field with links
- add multiple values (array) to post meta_input
- Check for custom field value in different post type than current one and do something
- How to add new Metadata options (Date, Author, etc.) for Posts?
- Search for meta_query does not return any result if combined with title
- get_the_ID() retrieves same ID on Gutenberg’s Query Loop
- Can I count every article following extracted meta value?