Skip to content

Instantly share code, notes, and snippets.

@hasanm95
Created September 8, 2017 09:59
Show Gist options
  • Save hasanm95/43f86b6cf2b7d42095b511ed775bb8fd to your computer and use it in GitHub Desktop.
Save hasanm95/43f86b6cf2b7d42095b511ed775bb8fd to your computer and use it in GitHub Desktop.
Basic Codestar metabox Code
function industry_rrfonline_options( $options ) {
$options = array();
$options[] = array(
"id" => "industry_rrfonline_slide_meta",
"post_type" => "industry-slide",
'title' => 'Slide Options',
'context' => 'normal',
'priority' => 'default',
'sections' => array(
array(
"name" => "industry_rrfonline_slide_metabox",
"fields" => array(
array(
'id' => 'text_clr',
'type' => 'color_picker',
'title' => 'Slide text color',
'default' => '#ffbc00',
),
array(
'id' => 'enable_overlay',
'type' => 'switcher',
'title' => 'Enabled Overlay',
'default' => false,
),
array(
'id' => 'overlay_opacity',
'type' => 'number',
'title' => 'Overlay opacity',
'desc' => 'Type a number for overlay opacity 1-100 number only',
'default' => "70",
'dependency' => array( 'enable_overlay', '==', true),
),
)
)
),
);
return $options;
}
add_filter( 'cs_metabox_options', 'industry_rrfonline_options' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment