Advertisement
samsam

Wordpress CustomMetabox code

Dec 3rd, 2011
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. This works for SINGLE CHECKBOX — when checked, it returns the word 'on' but doesn't show the Description on the front-end?
  2. <p><?php echo get_post_meta( $post->ID, '_cmb_test_checkbox', true); ?></p>
  3.  
  4.  
  5. Neither of these work for MULTI-CHECKBOXES: ( i know they're not too different)
  6.  
  7. <p><?php $value = get_post_meta( $post->ID, '_cmb_test_multicheckbox', true ); echo $value; ?></p>
  8.  
  9. <p><?php echo get_post_meta( $post->ID, '_cmb_test_multicheckbox', true); ?></p>
  10.  
  11.  
  12. This works fine for RADIO BUTTONS (but not for MULTI-CHECKBOXES:)
  13. <p><?php $radios = get_post_meta( get_the_ID( ), '_cmb_test_radio', false );
  14. foreach ( $radios as $radio ) {
  15. echo $radio;
  16. }
  17. ?></p>
  18.  
  19. This Does NOT work for RADIOS...
  20. <p><?php $radios = get_post_meta( get_the_ID( ), '_cmb_test_radio', false ); echo $radio; ?></p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement