Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'cmb2_init', 'yourprefix_register_about_page_metabox' );
- /**
- * Hook in and add a metabox that only appears on the 'About' page
- */
- function yourprefix_register_about_page_metabox() {
- // Start with an underscore to hide fields from custom fields list
- $prefix = 'rio_members';
- /**
- * Metabox to be displayed on a single page ID
- */
- $cmb_about_page = new_cmb2_box( array(
- 'id' => $prefix . 'metabox',
- 'title' => __( 'Members Signup & Expiration', 'cmb2' ),
- 'object_types' => array( 'user', ), // Post type
- 'context' => 'normal',
- 'priority' => 'high',
- 'show_names' => true, // Show field names on the left
- ) );
- if( current_user_can('read') ) {
- // stuff here for admins or editors
- $cmb_about_page->add_field( array(
- 'name' => __( 'Members Signup & Expiration date', 'cmb2' ),
- 'desc' => __( 'Set expiration date of membership', 'cmb2' ),
- 'id' => $prefix . 'datetime_expiration',
- 'type' => 'text_date_timestamp',
- ) );
- echo $prefix . 'datetime_expiration';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment