How do I display an array of custom meta on the front end?

Hi guys

I’m using Jaredatch’s Custom Meta Box class to create a multicheck metabox (https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress).

I’ve created a few options and would like to display on the front end whichever options have been checked.

I usually display custom meta using something like:

<?php if ( get_post_meta(get_the_ID(), ‘_cmb_mymeta’, true) ) {

echo get_post_meta(get_the_ID(), “_cmb_mymeta”, true); } ?>

But in this instance, it only displays the first option that is checked, not all of them.

What I really want to do is display each option that has been checked as a

  • Thanks, Martin

    • Vaughan
      • Ex Staff

      hiya

      thanks for the post.

      i’m not sure about this. have you asked the plugin developer as he might know exactly.

      without being familiar with the plugin or how it works, i’m not sure on how the query would look.

      i suppose wp_query might be used, or wpdb->query with an SQL SELECT statement to grab all the rows that have value for checked, that would give you an array of rows i guess.

      hope this helps.

      thanks