Skip to content

Instantly share code, notes, and snippets.

@salehahmadbabu
Created February 10, 2018 15:33
Show Gist options
  • Save salehahmadbabu/317111e81e385a386b6389a2b12a7916 to your computer and use it in GitHub Desktop.
Save salehahmadbabu/317111e81e385a386b6389a2b12a7916 to your computer and use it in GitHub Desktop.
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
function stock_theme_metabox($options){
$options = array(); // remove old options
$options[] = array(
'id' => 'stock_page_options',
'title' => esc_html__('Page Options', 'stock-theme'),
'post_type' => 'page',
'context' => 'normal',
'priority' => 'high',
'sections' => array(
// begin: a section
array(
'name' => 'stock_page_options_meta',
'icon' => 'fa fa-cog',
// begin: fields
'fields' => array(
// begin: a field
array(
'id' => 'enable_title',
'type' => 'switcher',
'title' => esc_html__('Enable title?', 'stock-theme'),
'default' => true,
'desc' => esc_html__('If you want to enable title, select yes.', 'stock-theme')
)
), // end: fields
), // end: a section
),
);
return $options;
}
add_filter( 'cs_metabox_options', 'stock_theme_metabox' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment