Skip to content

Instantly share code, notes, and snippets.

@hashtheme
Created April 7, 2018 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hashtheme/04f0302326b893660294a57d56a2ef0e to your computer and use it in GitHub Desktop.
Save hashtheme/04f0302326b893660294a57d56a2ef0e to your computer and use it in GitHub Desktop.
code
<?php
require get_template_directory() . '/inc/cs-framework/cs-framework.php';
function industry_rrfonline_theme_metabox( $options ) {
$options = array();
$options[] = array(
'id' => 'industry_rrfonline_slide_meta',
'title' => 'Slider Section',
'post_type' => 'slider',
'context' => 'normal',
'priority' => 'default',
'icon' => 'fa fa-heart',
'sections' => array(
array(
'name' => 'industry_rrfonline_slide_metaboxss',
'title' => 'Slider Text Color',
'fields' => array(
array(
'id' => 'width',
'type' => 'select',
'title' => 'Slider text width',
'options' => array(
'col-md-4' => '4 Column',
'col-md-5' => '5 Column',
'col-md-6' => '6 Column',
'col-md-7' => '7 Column',
'col-md-8' => '8 Column',
'col-md-9' => '9 Column',
'col-md-10' => '10 Column',
'col-md-11' => '11 Column',
'col-md-12' => '12 Column',
),
'default' => 'col-md-6',
),
array(
'id' => 'offset',
'type' => 'select',
'title' => 'Slider text offset',
'options' => array(
'no-offset' => 'No Offset',
'col-md-offset-1' => '1 Column',
'col-md-offset-2' => '2 Column',
'col-md-offset-3' => '3 Column',
'col-md-offset-4' => '4 Column',
'col-md-offset-5' => '5 Column',
'col-md-offset-6' => '6 Column',
'col-md-offset-7' => '7 Column',
'col-md-offset-2' => '8 Column',
),
'default' => 'no-offset',
),
array(
'id' => 'align',
'type' => 'select',
'title' => 'Slider text align',
'options' => array(
'left' => 'Left',
'right' => 'Right',
'center' => 'Center',
),
'default' => 'left',
),
array(
'id' => 'text_color',
'type' => 'color_picker',
'default' => '#333',
'title' => 'Slider Text Color',
),
array(
'id' => 'enable_opacity',
'type' => 'switcher',
'title' => 'Enable Opacity',
'default' => false,
),
array(
'id' => 'overlay_opacity',
'type' => 'number',
'title' => 'overlay_opacity Opacity',
'default' => '70',
'dependency' => array( 'enable_opacity', '==', 'true' ),
),
array(
'id' => 'overlay_color',
'type' => 'color_picker',
'title' => 'overlay opacity color',
'default' => '#333',
'dependency' => array( 'enable_opacity', '==', 'true' ),
)
)
)
)
);
$options[] = array(
'id' => 'industry_rrfonline_page_meta',
'title' => 'Page Options',
'post_type' => 'page',
'context' => 'normal',
'priority' => 'default',
'sections' => array(
array(
'name' => 'industry_rrfonline_page_metabox',
'fields' => array(
array(
'id' => 'header_style',
'type' => 'select',
'title' => 'Header Style',
'options' => array(
'1' => 'Header 1',
'2' => 'Header 2',
),
'default' => '1',
),
array(
'id' => 'enable_title',
'type' => 'switcher',
'title' => 'Enable Page Title',
'default' => true,
),
array(
'id' => 'custom_title',
'type' => 'textarea',
'title' => 'Enable Page Title',
'dependency' => array( 'enable_title', '==', 'true' ),
),
array(
'id' => 'title_text_direction',
'type' => 'select',
'title' => 'Title Text Align',
'options' => array(
'left' => 'Left',
'center' => 'Center',
'right' => 'Right',
),
'default' => 'Left',
'dependency' => array( 'enable_title', '==', 'true' ),
),
)
)
)
);
return $options;
}
add_filter( 'cs_metabox_options', 'industry_rrfonline_theme_metabox' );
// framework options filter example
function industry_rrfonline_theme_options( $options ) {
$options = array(); // remove old options
$options[] = array(
'name' => 'social',
'title' => 'Socila Settings',
'icon' => 'fa fa-heart',
'fields' => array(
array(
'id' => 'socials',
'type' => 'group',
'title' => 'Logo Text',
'button_title' => 'Add New',
'accordion_title' => 'Add New Field',
'fields' => array(
array(
'id' => 'icon',
'type' => 'icon',
'title' => 'Select Icon',
),
array(
'id' => 'link',
'type' => 'text',
'title' => 'Link',
),
),
)
)
);
$options[] = array(
'name' => 'header_options',
'title' => 'Header Settings',
'icon' => 'fa fa-heart',
'fields' => array(
array(
'id' => 'logo_text',
'type' => 'text',
'title' => 'Logo Text',
),
array(
'id' => 'header_1_links',
'type' => 'group',
'title' => 'Header 1 Link',
'button_title' => 'Add New',
'accordion_title' => 'Add New Link',
'fields' => array(
array(
'id' => 'text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'link',
'type' => 'text',
'title' => 'link',
),
array(
'id' => 'color',
'type' => 'color_picker',
'default' => '#fff',
'title' => 'Background Color',
),
array(
'id' => 'text_color',
'type' => 'color_picker',
'default' => '#fff',
'title' => 'Text Color',
),
array(
'id' => 'tab',
'type' => 'select',
'title' => 'Link Open In',
'options' => array(
'_self' => 'Same Tab',
'_blank' => 'New Tab',
),
)
),
),
array(
'id' => 'menu_width',
'type' => 'select',
'title' => 'Menu Width',
'default' => 'col-md-8',
'options' => array(
'col-md-4' => '4 Column',
'col-md-5' => '5 Column',
'col-md-6' => '6 Column',
'col-md-7' => '7 Column',
'col-md-8' => '8 Column',
'col-md-9' => '9 Column',
'col-md-10' => '10 Column',
'col-md-11' => '11 Column',
'col-md-12' => '12 Column',
),
),
array(
'id' => 'enable_search',
'type' => 'switcher',
'default' => true,
'title' => 'Enable serch on menu?',
),
array(
'id' => 'search_width',
'type' => 'select',
'title' => 'Search Width',
'default' => 'col-md-4',
'options' => array(
'col-md-3' => '3 Column',
'col-md-4' => '4 Column',
'col-md-5' => '5 Column',
'col-md-6' => '6 Column',
'col-md-7' => '7 Column',
'col-md-8' => '8 Column',
'col-md-9' => '9 Column',
'col-md-10' => '10 Column',
'col-md-11' => '11 Column',
'col-md-12' => '12 Column',
),
'dependency' => array( 'enable_search', '==', 'true' ),
),
)
);
$options[] = array(
'name' => 'typography',
'title' => 'Typography',
'icon' => 'fa fa-heart',
'fields' => array(
array(
'id' => 'body_font',
'type' => 'typography',
'title' => 'Body Font',
'default' => array(
'family' => 'Montserrat',
'variant' => '300',
),
),
array(
'id' => 'body_font_variants',
'type' => 'checkbox',
'title' => 'body font variants',
'default' => array( '300', '300i','regular','italic','600','600i','700','700i' ),
'options' => array(
'300' => '300',
'300i' => '300 Italic',
'regular' => '400',
'italic' => '400 Italic',
'500' => '500',
'500i' => '500 Italic',
'600' => '600',
'600i' => '600 Italic',
'700' => '700',
'700i' => '700 Italic',
'800' => '800',
'800i' => '800 Italic',
'900' => '900',
'900i' => '900 Italic',
),
),
array(
'id' => 'defferent_heading_font',
'type' => 'switcher',
'title' => 'Select heading',
'default' => false
),
array(
'id' => 'heading_font',
'type' => 'typography',
'title' => 'heading Font',
'default' => array(
'family' => 'Montserrat',
'variant' => '300',
),
'dependency' => array( 'defferent_heading_font', '==', 'true' ),
),
array(
'id' => 'heading_font_variants',
'type' => 'checkbox',
'title' => 'heading font variants',
'default' => array( '300', '300i','regular','italic','600','600i','700','700i' ),
'options' => array(
'300' => '300',
'300i' => '300 Italic',
'regular' => '400',
'italic' => '400 Italic',
'500' => '500',
'500i' => '500 Italic',
'600' => '600',
'600i' => '600 Italic',
'700' => '700',
'700i' => '700 Italic',
'800' => '800',
'800i' => '800 Italic',
'900' => '900',
'900i' => '900 Italic',
),
'dependency' => array( 'defferent_heading_font', '==', 'true' ),
),
)
);
$options[] = array(
'name' => 'styling',
'title' => 'styling',
'icon' => 'fa fa-heart',
'fields' => array(
array(
'id' => 'header_1_menu_background_color',
'type' => 'color_picker',
'title' => 'header 1 background Color',
'default' => '#2a3338'
),
array(
'id' => 'header_2_menu_background_color',
'type' => 'color_picker',
'title' => 'header 2 background Color',
'default' => '#f3c932'
),
array(
'id' => 'primary_color',
'type' => 'color_picker',
'title' => 'primary Color',
'default' => '#f3c932'
),
array(
'id' => 'secondary_color',
'type' => 'color_picker',
'title' => 'secondary Color',
'default' => '#46be25'
)
)
);
return $options;
}
add_filter( 'cs_framework_options', 'industry_rrfonline_theme_options' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment