Created
July 1, 2017 18:23
-
-
Save bulentsakarya/fa690b1c57728ba6e86e7c61dc2fed1c to your computer and use it in GitHub Desktop.
cmb2 code field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'cmb2_init', 'wprsscode_add_metabox' ); | |
function wprsscode_add_metabox() { | |
$prefix = '_cmb_'; | |
$cmb = new_cmb2_box( array( | |
'id' => $prefix . 'wprss_code', | |
'title' => __( 'Your Code', 'nivothemes' ), | |
'object_types' => array( 'post' ), | |
'context' => 'advance', | |
'priority' => 'high', | |
) ); | |
$cmb->add_field( array( | |
'name' => __( 'Code', 'nivothemes' ), | |
'id' => $prefix . 'wp_code', | |
'type' => 'textarea_code', | |
'on_front' => true, | |
'repeatable' => true, | |
) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment