RubenMartins / cmb2-extensions

This Repository is for extensions for the cmb2 wordpress plugin.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMB2 Code Snippet Library

This is a CMB2 Extension repository which help modify the default behavior of CMB2 and extends it's functionality.

Extension are organized into categories (folders) and each Extension is placed in its own file with a name that describes what it does.

Usage

You can view wiki page to usage and setup guide: Documentation

CMB2 Tabs

CMB2 Tabs is an extenstion for CMB2 which allow you to oragnize fields into tabs.

cmb2 tabs

Example

// Classic CMB2 declaration
$cmb = new_cmb2_box( array(
	'id'           => 'prefix-metabox-id',
	'title'        => __( 'Post Info' ),
	'object_types' => array( 'post', ), // Post type
	'tabs'      => array(
		'contact' => array(
			'label' => __( 'Contact', 'cmb2' ),
			//'show_on_cb' => 'yourprefix_show_if_front_page',
		),
		'social'  => array(
			'label' => __( 'Social Media', 'cmb2' ),
			'icon'  => 'dashicons-share', // Dashicon
		),
	),
	'tab_style'   => 'default',
) );

// Add new field
$cmb_demo->add_field( array(
	'name' => esc_html__( 'Test Text Medium', 'cmb2' ),
	'desc' => esc_html__( 'field description (optional)', 'cmb2' ),
	'id'   => $prefix . 'textmedium',
	'type' => 'text_medium',
	'tab'  => 'contact',
	'render_row_cb' => array( 'CMB2_Tabs', 'tabs_render_row_cb' ),
) );

// Add new field
$cmb_demo->add_field( array(
	'name' => esc_html__( 'Test Text Medium', 'cmb2' ),
	'desc' => esc_html__( 'field description (optional)', 'cmb2' ),
	'id'   => $prefix . 'textmedium2',
	'type' => 'text_medium',
	'tab'  => 'social',
	'render_row_cb' => array( 'CMB2_Tabs', 'tabs_render_row_cb' ),
) );

About

This Repository is for extensions for the cmb2 wordpress plugin.

License:GNU General Public License v3.0


Languages

Language:PHP 75.8%Language:CSS 22.7%Language:JavaScript 1.5%