Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Displaying a div from an assigned meta_value when on a page

If you just want to check if a meta value exists before outputting markup, then

if( get_post_meta( $post->ID, '_cmb_linkCheckbox', true ) ){
    ?>
    <section id="footerLinks">
        <?php // your markup... ?>
    </section>
    <?php
}

or if the value is “on”:

if( 'on' == get_post_meta( $post->ID, '_cmb_linkCheckbox', true ) ){
    // etc..
}

Related Posts:

  1. WP_Meta_Query object with conditionals
  2. How to retrive Custom Post Type Meta Fields in Custom WP_Query
  3. Query all posts where a meta key does not exist
  4. Meta query with boolean true/false value
  5. Get post with multiple meta keys and value
  6. How to add multiple images to a custom post type single post?
  7. How do I remove all the metaboxes for a custom post type?
  8. Get all posts from custom post type and insert in select input as metabox
  9. Detect meta value changes when post is updated (post_updated)
  10. How to sort CPT by custom meta value (date), and return posts month by month
  11. How Do I Use WP_Query to Run This Database Query as Search Result?
  12. Can’t sort order of wp_query with 2 meta keys
  13. Having trouble with custom post type / meta box
  14. Query for posts from any post type but only add instock products
  15. How can I include meta box content when searching?
  16. update a post meta from a single table cell TablePress
  17. update custom post type meta from a shortcode
  18. Custom Meta Boxes – Nonce Issue – Move to trash issue
  19. Displaying Meta Box Image
  20. How to keep a check box in custom meta box for custom post type checked by default for add new post?
  21. How to add multiple featured image in meta box in post editor?
  22. Show metabox in custom-post-template depending on taxonomy term?
  23. Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
  24. Displaying custom posts only if custom meta box’s date is not expired
  25. Displaying Metabox value (custom post type taxonomy)
  26. How can I display my custom metaboxes on a custom post template?
  27. Meta Box Only in CPT Edit Page, Not in Add New
  28. get_post_meta is returning image id
  29. WordPress Orderby Numeric Value Not Working
  30. orderby in custom WP Query does not work
  31. Populate Custom Fields in a Custom Post Type?
  32. Custom meta box data array: foreach not working correctly?
  33. Undefined Variable – Custom Post Type Meta
  34. Display custom post type from dynamic custom field
  35. Populate dropdown from one custom post type inside another custom post type
  36. How to check if user meta field is empty in conditional else statement
  37. A better way to add a meta box to custom post types
  38. Metabox not show in categories custom post type cmb2
  39. WordPress request fiter order by related post’s post_title
  40. Show Custom Post Type meta boxes only on Page Edit
  41. Can’t publish custom post type – “You are not allowed to edit this post.”
  42. Meta Data for Custom Post Type not saving
  43. create custom meta box with default value
  44. How to Echo Metadata Value in Currency Format
  45. Issue on Working with Metabox – Checkbox to enable Sale Items
  46. How to get specific post meta by title or id
  47. Retrieving meta-box from a custom-post-type
  48. Why do I have to press the “Update” button twice to save my meta box values?
  49. Inefficient Query Confusion
  50. $post->post_meta not pulling any post in wordpress/php
  51. Values from meta-box not on $_POST
  52. WP_Query of custom post type sorted by meta_key has unexpected results
  53. Returning a custom content types with meta values
  54. Custom post type suddenly stoped working after WordPress 5 update
  55. Filter posts of custom post type by meta key in (List All Section)
  56. How can I output WPAlchemy repeating fields meta values in my page template?
  57. Meta box data is saved but NOT displayed in the meta box text field. Why?
  58. Save Metabox Custom Field Value
  59. Meta box data not saving
  60. Related posts meta_query CPT
  61. Meta box with front-end styling
  62. Sanitaizing Select Optin For Custom Post Type Metabox in WP
  63. Cannot Save MetaBox Data in Custom Post Type
  64. Add a class to post_class if more than one post shares same meta_value_num
  65. Function to return values from metabox
  66. Add a meta field to the list of results for a custom post type
  67. Empty meta-box returns publishdate if no value is set?
  68. how to compare different timestamps in wp-query for events custom post types?
  69. Custom Meta Box with variable number of fields
  70. Wp Meta Query does not work while simple Query Works
  71. Custom Post Type meta data getting deleted on bulk editing taxonomies
  72. After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
  73. Use WP_query to match post types based on custom field values
  74. How to sort by multiple values in a nested WP_Query
  75. Custom meta fields not showing up in WP_Response Object via custom endpoint
  76. How to get post by meta value
  77. Get meta values from parent post and save in child post
  78. Wp Query sort order from custom MetaBox
  79. How do I get all authors posts of a custom post type outside loop
  80. Linking posts together with Advanced Custom Fields “both ways”
  81. Metaboxes in Loop
  82. Custom meta box data not saving
  83. Collect custom post in a calendar
  84. How to get Current week and current date record wp query
  85. How to get post meta for custom post type and taxonomy
  86. get_post_meta for Custom Post Type ( CPT )
  87. Delete custom post type metadata without deleting the post in admin area
  88. Problem with ‘save_post’ hook not running
  89. WordPress custom post type
  90. Edit post meta direct from post.php?
  91. Howto: use existing post_meta as options for a different metabox (checkboxes or list)
  92. Custom Post Type meta oembed html output resulting in WSoD
  93. Values inside a custom field to determine which category posts to display
  94. Display a post count from a custom metabox selection
  95. How to query custom post then display sections by meta value
  96. Querying meta values within an array
  97. Post AND page parameter for WP function
  98. Custom Post Type + Custom Meta Query Not Showing 2012 Posts
  99. Use a Variable in update_post_meta as the $meta_key
  100. Quering a post object based on another related post object
Categories custom-post-types Tags custom-post-types, metabox, post-meta, wp-query
Trying to get property of non-object in shortocde
WordPress + Bootstrap [closed]

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress