Does this do the trick?
$consignment= get_post_meta($post->ID, 'availability', true);
if ($consignment == '') {
// code to run if the above is empty, eg.
echo "avaliable";
} else {
// else the code, eg.
echo $consignment;
}
Related Posts:
- Detect meta value changes when post is updated (post_updated)
- Displaying Meta Box Image
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Populate Custom Fields in a Custom Post Type?
- A better way to add a meta box to custom post types
- create custom meta box with default value
- How can I output WPAlchemy repeating fields meta values in my page template?
- Add a class to post_class if more than one post shares same meta_value_num
- Add a meta field to the list of results for a custom post type
- Empty meta-box returns publishdate if no value is set?
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Delete custom post type metadata without deleting the post in admin area
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- How do I Paginate Search Results for Custom Post Types?
- How can I add a column/s to wp_posts table?
- How do I remove all the metaboxes for a custom post type?
- How Can I save multiple records in same meta key?
- How to get custom metabox image field?
- Search everything (posts, pages, tags, cpt, meta)
- Custom field being erased after autosave
- How to select one major category (or custom taxonomy) for a custom post type?
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- How to get source of custom meta image?
- Metabox saving values
- Having trouble with custom post type / meta box
- add_meta_box: Datepicker like the one for postdate?
- update custom post type meta from a shortcode
- Custom Meta Boxes – Nonce Issue – Move to trash issue
- Multiple information using custom post type
- How to keep a check box in custom meta box for custom post type checked by default for add new post?
- How to add multiple featured image in meta box in post editor?
- Show metabox in custom-post-template depending on taxonomy term?
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- Display custom post on home page based on a metabox selection
- Meta Box Only in CPT Edit Page, Not in Add New
- get_post_meta is returning image id
- Why do I lose the content of meta boxes when I leave the page?
- Dynamically add / duplicate custom meta in custom post types
- How to Duplicate (multiple meta box)?
- List of Posts in a Custom Field
- Custom meta box data array: foreach not working correctly?
- Undefined Variable – Custom Post Type Meta
- dynamically add a custom field or metabox to custom post type [duplicate]
- How to implement a Google map store locator
- Posting to a Custom Post Type from front end – user generated content
- Update Post Meta for a logged in user
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Plugin – Combine Meta Box Input Fields into single saveble record
- Metabox not show in categories custom post type cmb2
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- Cannot save CPT meta box
- Permalinks: custom structure for taxonomy – tags?
- Custom fields for custom post type
- Add additional field to custom post_type
- Custom Post Meta from custom metaboxes is randomly being deleted
- Add a custom meta box for client to order CPT posts how they want
- Submitting Custom Post Types with custom fields from Front-end form
- How to Echo Metadata Value in Currency Format
- Issue on Working with Metabox – Checkbox to enable Sale Items
- delete_post_meta() for whole CPT / multiple posts?
- Why do I have to press the “Update” button twice to save my meta box values?
- Get custom term meta problem on single post type
- Display custom meta on page that has been check in custom post type
- Meta box data is saved but NOT displayed in the meta box text field. Why?
- How to call a post’s metadata in shortcode.php?
- WP_Meta_Query object with conditionals
- Sanitaizing Select Optin For Custom Post Type Metabox in WP
- delete duplicate meta_value with same post_id
- updating one custom meta field only
- Function to return values from metabox
- Saving metabox keys and storing values as array
- Custom fields for post or terms which don’t update on post update
- How can I add a meta[] to my custom post type and search by term with the Rest API?
- Show posts from WP Custom Post Type selected from a field in a metabox
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Where is get_post_meta value located?
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Problem with multi checkboxes value in metabox?
- Get meta values from parent post and save in child post
- How to Disable option of meta field if that option is selected for any other post in custom post type?
- Metaboxes in Loop
- Add more custom fields when creating a new custom post type
- Custom meta box data not saving
- Collect custom post in a calendar
- How to add post reference field to a plugin?
- Search form to find custom meta box generated data
- Problem with ‘save_post’ hook not running
- Edit post meta direct from post.php?
- Howto: use existing post_meta as options for a different metabox (checkboxes or list)
- Filter CPT based on meta box value using Flexible Posts widget?
- Advanced search form with filters for custom taxonomies and custom fields
- Textarea type on one field custom add_meta_box?
- loop through custom post-type with two meta_keys
- Extending a CPT by Created by another plugin
- Querying meta values within an array
- Creating entries with image attachements within posts and managing them in a list
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Adding a custom “Add Custom Field” button to Custom Meta boxes
- Use a Variable in update_post_meta as the $meta_key