Created
January 16, 2017 18:44
-
-
Save mklasen/4ee018ad7a1f52099020ae740a9f44f1 to your computer and use it in GitHub Desktop.
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
<?php | |
add_action( 'cmb2_admin_init', function() { | |
$prefix = 'mk_add_thickbox_'; | |
$metabox = new_cmb2_box( array( | |
'id' => $prefix.'box', | |
'title' => 'Signature', | |
'object_types' => array( 'post', ), | |
) ); | |
$metabox->add_field( array( | |
'name' => 'Signature', | |
'desc' => 'Draw a signature', | |
'id' => $prefix.'field', | |
'type' => 'mk_add_thickbox', | |
) ); | |
}); | |
add_action( 'cmb2_render_mk_add_thickbox', function() { | |
add_thickbox(); | |
?> | |
<div id="mk_thickbox" style="display:none;"> | |
<h1>Signature</h1> | |
<p>Draw your signature below..</p> | |
<div style="background: white; height: 200px; width: 100%; border: 1px solid #333; display: flex; justify-content: center; align-items: center; font-style: italic;">Draw your signature..</div> | |
</div> | |
<a href="#TB_inline?width=600&height=550&inlineId=mk_thickbox" class="thickbox">Enter signature..</a> | |
<?php | |
}, 10, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Custom field for CMB2 which opens thickbox.