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

Set class if a meta value is set within post archive

i suggest you check the the value of $checkbox by either checking checkbox under meta_key column in wp_postmeta or *your prefix_postmeta table in your database or simply do var_dump($checkbox); for testing if its 0 or null or an empty string or so then your if condition will not return true and $has_video will not be assigned to ‘icon-has_video’.

Related Posts:

  1. Saving multiple custom meta box fields
  2. What is the index [0] for on post meta fields?
  3. Custom field metabox not showing in back-end
  4. How to hide meta box values from custom fields list?
  5. Create meta boxes that don’t show in custom fields
  6. How to break meta values into different items and avoid duplicates?
  7. Custom fields to save multiple values
  8. wp_handle_upload error “Specified file failed upload test” but still creates attachment?
  9. How to wrap meta values seperated by comma in ? [closed]
  10. How to create a Custom Meta Box with Name/Value Admin User Input Fields?
  11. Create Multiple File Upload Metabox in WordPress
  12. Run a check for multiple meta key values
  13. Button inside Custom Meta Box triggering the Update Button
  14. Why is my Custom Meta Box Field Inputs NOT saving?
  15. get_posts in meta box dropdown not showing latest posts
  16. How can you include custom post meta in search without calling each key?
  17. Display Custom Meta Box Field Only If Value is Present
  18. shortcode in a custom metabox
  19. Problem with saving large amount of data in postmeta/usermeta
  20. Move Title and the Content WYSIWYG editor position
  21. How to validate select field in post meta?
  22. IF Custom field value equals ZERO
  23. How to use media upload on metabox post page without breaking TinyMCE?
  24. Let’s Create Custom Field Template Documentation
  25. How add multiple wp_editor_box to new post
  26. Update post meta custom field using block editor
  27. Can I save post meta programatically without setting metaboxes?
  28. Meta box values are displayed on Custom Fields list. Is it possible to hide them?
  29. If metabox has content display content
  30. put saved metabox values back into fields and then display on the front end
  31. Add a class to post_class if more than one post shares same meta_value_num
  32. Show array of meta_value in Edit Post Coloum
  33. How to improve my non-unique metadata MySQL entries?
  34. WordPress Blocks, setAttributes not saving
  35. Allow HTML in Custom Metabox area
  36. Custom field metabox not showing in back-end
  37. Save, update, get and sanitize post meta as HTML not plain
  38. Create Meta boxes dynamically
  39. Get meta value when the page is a blog archive
  40. Can’t save meta field value if the title not set
  41. Display Data From This Custom Media Upload Meta Box?
  42. When post is updated, custom metadata in text area field is overwritten
  43. wp_postmeta are updated for only one page
  44. Custom Field: Display only if a specific key is selected outside the loop
  45. When editing a post with a custom meta box the values aren’t displaying correctly
  46. How to add new Metadata options (Date, Author, etc.) for Posts?
  47. WP Query Args – search by meta_key or title
  48. get Custom field label (select/dropdown) on front end
  49. SQL query based on two different custom field values
  50. Block Editor – Meta values not saved, meta changes to empty array on update
  51. Can I exclude a post by meta key using pre_get_posts function?
  52. Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
  53. Max length of meta_value
  54. Custom post meta field effect on the performance on the post
  55. How to get custom post meta using REST API
  56. Custom field/meta populated by dropdown of existing posts?
  57. Difference between meta keys with _ and without _ [duplicate]
  58. Orderby meta_value only returns posts that have existing meta_key
  59. What is “meta_input” parameter in wp_insert_post() used for?
  60. How to enable revisions for post meta data?
  61. The “_encloseme” Meta-Key Conundrum
  62. Individual Widgets per Page
  63. Best way to programmatically remove a category/term from a post
  64. Gutenberg add a custom metabox to default blocks
  65. ‘Preview Changes’ for custom meta boxes?
  66. Using TinyMce with textareas in meta boxes on custom post types
  67. Using get_post_meta with new_to_publish
  68. add meta box – custom field : which to choose?
  69. SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
  70. Add metabox to document tab in gutenberg
  71. How to add add_meta_box to specific Page Template?
  72. So much data in postmeta
  73. Can I count the number of users matching a value in a multiple value key?
  74. When using add_post_meta and update_post_meta, is there any way to give the individual arrays keys?
  75. Auto sort the wp-admin post list by a meta key
  76. Adding another state (spam, reject, approve) to wordpress comments?
  77. get_post_meta() unserialize issue – returns boolean(false)
  78. What is the advantage of the wp_options design pattern?
  79. Arrange custom fields with drag and drop?
  80. Storing meta fields multiple times OR once with multi dimensional array?
  81. How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
  82. Unable to get Preview of Uploaded image within a Custom Meta box
  83. How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
  84. Allow user to create instances of custom field
  85. Using media-upload.php to upload mp3 via custom fields
  86. extend Meta Box / Document Panel
  87. display specific custom fields
  88. Save metabox with multiple checkbox array
  89. Is there a hook / action that is triggered when adding or removing a post thumbnail?
  90. Add custom option to Standard Page Attributes Meta Box
  91. How to store the value of a custom field dropdown select for post referencing?
  92. get_pages sort alphabetically by meta value
  93. Add multiple images to a page sidebar
  94. Meta keywords and descriptions plugin for manually editing meta for each page/post
  95. passing argument to get_template_part() or a better way to code
  96. Only show metabox when date-value in other metabox is over?
  97. Is it possible to store arrays in a custom field?
  98. Get updated meta data after save_post hook
  99. Detect meta value changes when post is updated (post_updated)
  100. Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
Categories custom-field Tags custom-field, meta-value, metabox, post-class, post-meta
How to pull latest posts from a specific category
Product page not found if product data is set Appointment Service

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
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 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