• Resolved Head Goldfish

    (@shoelaced)


    I know this plugin supports Custom Attributes as well as the default Custom Fields, so it seems like it would support other types of custom meta boxes. However, when using the #_ATT{} tag in the shortcode, it doesn’t seem to work when using the meta key for other custom meta.

    I use the CMB2 plugin to set up a bunch of custom meta boxes and I like it because I can have all sorts of different types, radio selects, wysiwyg, repeatable groups, etc., all of which is just saved as regular custom meta with regular custom meta keys. I’d like to be able to keep it since it’s so much more flexible and already set up to display these custom meta boxes on the ‘event’ post type.

    Is it possible to pull custom meta by key instead of by label to #_ATT{} in the event list shortcodes? Or pull the meta in a different way?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Head Goldfish

    (@shoelaced)

    As an alternative, is there place where I can find the meta keys associated with the Placeholders so that I can write a custom loop and not use the shortcode at all?

    Thread Starter Head Goldfish

    (@shoelaced)

    Hm, nevermind – I found a method that I can use in theme files instead of the shortcode.

    Set up a foreach:

    <?php $events = EM_Events::get(array('scope'=>'future', 'limit'=>6)); 
           foreach( $events as $EM_Event ){ ?>

    Then use this to pull the placeholders:

    <?php echo $EM_Event->output("#_EVENTLINK"); ?>

    And the usual way of getting custom meta:

    <?php if( get_post_meta( $EM_Event->ID, 'event_subtitle', true )) {
           echo '<p>'.get_post_meta( $EM_Event->ID, 'event_subtitle', true ).'</p>'; } ?>

    And then of course close the foreach:

    <?php } ?>

    Hope this helps any other CMB2 users!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Meta Boxes’ is closed to new replies.