Created
September 1, 2018 14:53
-
-
Save humayunahmed8/798e6e00998498c7f09da2e39d9706b9 to your computer and use it in GitHub Desktop.
Stock Metabox & Options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly. | |
function stock_humayunbd_theme_shortcode_options($options){ | |
$options = array(); // remove shortcode old options | |
} | |
add_filter('cs_shortcode_options', 'stock_humayunbd_theme_shortcode_options'); | |
function stock_humayunbd_theme_customizer($options){ | |
$options = array(); // remove customizer old options | |
} | |
add_filter('cs_customize_options', 'stock_humayunbd_theme_customizer'); | |
function stock_humayunbd_page_metabox($options){ | |
$options = array(); // remove old options | |
// ----------------------------------------- | |
// Page Metabox Options - | |
// ----------------------------------------- | |
$options[] = array( | |
'id' => 'stock_page_options', | |
'title' => esc_html__('Page Options','stock-humayunbd'), | |
'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( | |
array( | |
'id' => 'enable_title', | |
'type' => 'switcher', | |
'title' => esc_html__('Enable Title', 'stock-humayunbd'), | |
'default' => true, | |
'desc' => esc_html__('If you want to enable page title,You can select on', 'stock-humayunbd'), | |
), | |
array( | |
'id' => 'custom_title', | |
'type' => 'text', | |
'title' => esc_html__('Custom title', 'stock-humayunbd'), | |
'dependency' => array( 'enable_title', '==', 'true' ), | |
'desc' => esc_html__('Type your custom title', 'stock-humayunbd'), | |
), | |
), // end: fields | |
), // end: a section | |
), | |
); | |
// ----------------------------------------- | |
// Slide Options - | |
// ----------------------------------------- | |
$options[] = array( | |
'id' => 'stock_slide_options', | |
'title' => esc_html__('Slide Options','stock-humayunbd'), | |
'post_type' => 'slide', | |
'context' => 'normal', | |
'priority' => 'high', | |
'sections' => array( | |
// begin: a section | |
array( | |
'name' => 'stock_page_options_meta', | |
// begin: fields | |
'fields' => array( | |
array( | |
'id' => 'buttons', | |
'type' => 'group', | |
'title' => esc_html__('Slide buttons', 'stock-humayunbd'), | |
'button_title' => esc_html__('Add New', 'stock-humayunbd'), | |
'accordion_title' => esc_html__('Add New button', 'stock-humayunbd'), | |
'fields' => array( | |
array( | |
'id' => 'type', | |
'type' => 'select', | |
'title' => esc_html__('Button type','stock-humayunbd'), | |
'desc' => esc_html__('Select button type','stock-humayunbd'), | |
'options' => array( | |
'bordered' => esc_html__('Bordered button','stock-humayunbd'), | |
'filled' => esc_html__('Filled Button','stock-humayunbd'), | |
), | |
), | |
array( | |
'id' => 'text', | |
'type' => 'text', | |
'title' => esc_html__('Button text','stock-humayunbd'), | |
'desc' => esc_html__('Type button text','stock-humayunbd'), | |
'default' => esc_html__('Get a free consultation','stock-humayunbd'), | |
), | |
array( | |
'id' => 'link_type', | |
'type' => 'select', | |
'title' => esc_html__('Link type','stock-humayunbd'), | |
'options' => array( | |
'1' => esc_html__('WordPress Page','stock-humayunbd'), | |
'2' => esc_html__('External Link','stock-humayunbd'), | |
), | |
), | |
array( | |
'id' => 'link_to_page', | |
'type' => 'select', | |
'title' => esc_html__('Type Page','stock-humayunbd'), | |
'options' => 'page', | |
'dependency' => array( 'link_type', '==', '1' ), | |
), | |
array( | |
'id' => 'link_to_external', | |
'type' => 'text', | |
'title' => esc_html__('Type URL','stock-humayunbd'), | |
'dependency' => array( 'link_type', '==', '2' ), | |
), | |
), | |
), | |
array( | |
'id' => 'enable_overlay', | |
'type' => 'switcher', | |
'default' => true, | |
'title' => esc_html__('Enable Overlay?','stock-humayunbd'), | |
), | |
array( | |
'id' => 'overlay_opacity', | |
'type' => 'text', | |
'default' => esc_attr('.7', 'stock-humayunbd'), | |
'title' => esc_html__('Overlay Percentage','stock-humayunbd'), | |
'desc' => esc_html__('Type overlay percentage in floating value, Max value is 1','stock-humayunbd'), | |
'dependency' => array( 'enable_overlay', '==', 'true' ), | |
), | |
array( | |
'id' => 'overlay_color', | |
'type' => 'color_picker', | |
'default' => esc_attr('#181A1F', 'stock-humayunbd'), | |
'title' => esc_html__('Overlay Color','stock-humayunbd'), | |
'desc' => esc_html__('Select overlay color','stock-humayunbd'), | |
'dependency' => array( 'enable_overlay', '==', 'true' ), | |
), | |
), // end: fields | |
) // end: a section | |
), | |
); | |
return $options; | |
} | |
add_filter( 'cs_metabox_options', 'stock_humayunbd_page_metabox' ); | |
function stock_humayunbd_option_settings($settings){ | |
$settings = array(); | |
$settings = array( | |
'menu_title' => esc_html__('Theme Options','stock-humayunbd'), | |
'menu_type' => 'theme', // menu, submenu, options, theme, etc. | |
'menu_slug' => esc_html__('stock-theme-options','stock-humayunbd'), | |
'ajax_save' => true, | |
'show_reset_all' => true, | |
'framework_title' => esc_html__('Stock - by Humayun Ahmed','stock-humayunbd'), | |
); | |
return $settings; | |
} | |
add_filter('cs_framework_settings', 'stock_humayunbd_option_settings'); | |
function stock_humayunbd_options($options){ | |
$options = array(); // remove old options | |
// Header Settings | |
$options[] = array( | |
'name' => 'stock_humayunbd_header_settings', | |
'title' => esc_html__('Header Settings','stock-humayunbd'), | |
'icon' => 'fa fa-heart', | |
'fields' => array( | |
array( | |
'id' => 'header_iconic_boxes', | |
'type' => 'group', | |
'title' => esc_html__('Iconic Boxes','stock-humayunbd'), | |
'desc' => esc_html__('If you want add iconic box on header, add those here.','stock-humayunbd'), | |
'button_title' => esc_html__('Add New','stock-humayunbd'), | |
'accordion_title' => esc_html__('Add New Box','stock-humayunbd'), | |
'fields' => array( | |
array( | |
'id' => 'title', | |
'type' => 'text', | |
'title' => esc_html__('Title','stock-humayunbd'), | |
), | |
array( | |
'id' => 'icon', | |
'type' => 'icon', | |
'title' => esc_html__('Box icon','stock-humayunbd'), | |
), | |
array( | |
'id' => 'big_title', | |
'type' => 'text', | |
'title' => esc_html__('Big title','stock-humayunbd'), | |
), | |
array( | |
'id' => 'link', | |
'type' => 'text', | |
'title' => esc_html__('Box link','stock-humayunbd'), | |
'desc' => esc_html__('Leave it blank, if you do not want a link','stock-humayunbd'), | |
), | |
), | |
), | |
) | |
); | |
// Social Links | |
$options[] = array( | |
'name' => 'stock_humayunbd_social_links', | |
'title' => esc_html__('Social links','stock-humayunbd'), | |
'icon' => 'fa fa-heart', | |
'fields' => array( | |
array( | |
'id' => 'social_links', | |
'type' => 'group', | |
'title' => esc_html__('Social links','stock-humayunbd'), | |
'button_title' => 'Add New', | |
'accordion_title' => esc_html__('Add New link','stock-humayunbd'), | |
'fields' => array( | |
array( | |
'id' => 'icon', | |
'type' => 'icon', | |
'title' => esc_html__('Social icon','stock-humayunbd'), | |
), | |
array( | |
'id' => 'link', | |
'type' => 'text', | |
'title' => esc_html__('Link','stock-humayunbd'), | |
), | |
), | |
), | |
) | |
); | |
// Logo Setting | |
$options[] = array( | |
'name' => 'stock_humayunbd_logo_settings', | |
'title' => esc_html__('Logo Settings','stock-humayunbd'), | |
'icon' => 'fa fa-heart', | |
'fields' => array( | |
array( | |
'id' => 'enable_image_logo', | |
'type' => 'switcher', | |
'title' => esc_html__('Enable image logo','stock-humayunbd'), | |
'default' => false, | |
), | |
array( | |
'id' => 'image_logo', | |
'type' => 'image', | |
'title' => esc_html__('Upload logo','stock-humayunbd'), | |
'dependency' => array( 'enable_image_logo', '==', 'true' ), | |
), | |
array( | |
'id' => 'image_logo_max_width', | |
'type' => 'text', | |
'default' => esc_attr('200','stock-humayunbd'), | |
'title' => esc_html__('Logo max width','stock-humayunbd'), | |
'desc' => esc_html__('Type logo max width as numeric value','stock-humayunbd'), | |
'dependency' => array( 'enable_image_logo', '==', 'true' ), | |
), | |
array( | |
'id' => 'text_logo', | |
'type' => 'text', | |
'title' => esc_html__('Logo text','stock-humayunbd'), | |
'default' => esc_html__('Stock','stock-humayunbd'), | |
'dependency' => array( 'enable_image_logo', '==', 'false' ), | |
), | |
) | |
); | |
// Typography Setting | |
$options[] = array( | |
'name' => 'stock_humayunbd_typography_settings', | |
'title' => esc_html__('Typography Settings','stock-humayunbd'), | |
'icon' => 'fa fa-heart', | |
'fields' => array( | |
array( | |
'id' => 'body_fonts', | |
'type' => 'typography', | |
'title' => esc_html__('Body font','stock-humayunbd'), | |
'default' => array( | |
'family' => 'Roboto', | |
'variant' => 'regular', | |
'font' => 'google', // this is helper for output | |
), | |
), | |
array( | |
'id' => 'heading_fonts', | |
'type' => 'typography', | |
'title' => esc_html__('Heading font','stock-humayunbd'), | |
'default' => array( | |
'family' => 'Noto Serif', | |
'variant' => '700', | |
'font' => 'google', // this is helper for output | |
), | |
), | |
) | |
); | |
// Styling setting | |
$options[] = array( | |
'name' => 'stock_humayunbd_styling_settings', | |
'title' => esc_html__('Styling Settings','stock-humayunbd'), | |
'icon' => 'fa fa-heart', | |
'fields' => array( | |
array( | |
'id' => 'theme_color', | |
'type' => 'color_picker', | |
'title' => esc_html__('Theme color','stock-humayunbd'), | |
'default' => esc_attr__('#278cc1','stock-humayunbd'), | |
), | |
array( | |
'id' => 'theme_secondary_color', | |
'type' => 'color_picker', | |
'title' => esc_html__('Theme secondary color','stock-humayunbd'), | |
'default' => esc_attr__('#fef14a','stock-humayunbd'), | |
), | |
array( | |
'id' => 'enable_preloader', | |
'type' => 'switcher', | |
'title' => esc_html__('Enable preloader','stock-humayunbd'), | |
'default' => true, | |
), | |
array( | |
'id' => 'enable_box_layout', | |
'type' => 'switcher', | |
'title' => esc_html__('Enable box layout','stock-humayunbd'), | |
'default' => false, | |
), | |
array( | |
'id' => 'body_bg', | |
'type' => 'image', | |
'title' => esc_html__('Body background image','stock-humayunbd'), | |
'dependency' => array( 'enable_box_layout', '==', 'true' ), | |
), | |
array( | |
'id' => 'body_bg_color', | |
'type' => 'color_picker', | |
'title' => esc_html__('Body background color','stock-humayunbd'), | |
'dependency' => array( 'enable_box_layout', '==', 'true' ), | |
), | |
array( | |
'id' => 'body_bg_repeat', | |
'type' => 'select', | |
'default' => 'repeat', | |
'options' => array( | |
'repeat' => 'Repeat', | |
'no-repeat' => 'No Repeat', | |
'cover' => 'Cover', | |
), | |
'title' => esc_html__('Body background repeat','stock-humayunbd'), | |
'dependency' => array( 'enable_box_layout', '==', 'true' ), | |
), | |
array( | |
'id' => 'body_bg_attachment', | |
'type' => 'select', | |
'default' => 'scroll', | |
'options' => array( | |
'scroll' => 'Scroll', | |
'fixed' => 'Fixed', | |
), | |
'title' => esc_html__('Body background attachment','stock-humayunbd'), | |
'dependency' => array( 'enable_box_layout', '==', 'true' ), | |
), | |
) | |
); | |
// Blog Setting | |
$options[] = array( | |
'name' => 'stock_humayunbd_blog_settings', | |
'title' => esc_html__('Blog Settings','stock-humayunbd'), | |
'icon' => 'fa fa-heart', | |
'fields' => array( | |
array( | |
'id' => 'display_post_by', | |
'type' => 'switcher', | |
'title' => esc_html__('Display post by?','stock-humayunbd'), | |
'default' => true, | |
), | |
array( | |
'id' => 'display_post_date', | |
'type' => 'switcher', | |
'title' => esc_html__('Display post date?','stock-humayunbd'), | |
'default' => true, | |
), | |
array( | |
'id' => 'display_post_comment_count', | |
'type' => 'switcher', | |
'title' => esc_html__('Display comment count?','stock-humayunbd'), | |
'default' => true, | |
), | |
array( | |
'id' => 'display_post_category', | |
'type' => 'switcher', | |
'title' => esc_html__('Display posted in categories?','stock-humayunbd'), | |
'default' => true, | |
), | |
array( | |
'id' => 'display_post_tag', | |
'type' => 'switcher', | |
'title' => esc_html__('Display posted in tag?','stock-humayunbd'), | |
'default' => true, | |
), | |
array( | |
'id' => 'display_post_nav', | |
'type' => 'switcher', | |
'title' => esc_html__('Enable next previous link on single post?','stock-humayunbd'), | |
'default' => true, | |
), | |
) | |
); | |
// Footer Setting | |
$options[] = array( | |
'name' => 'stock_humayunbd_footer_settings', | |
'title' => esc_html__('Footer Settings','stock-humayunbd'), | |
'icon' => 'fa fa-heart', | |
'fields' => array( | |
array( | |
'id' => 'footer_bg', | |
'type' => 'color_picker', | |
'title' => esc_html__('Footer background color','stock-humayunbd'), | |
'default' => esc_attr__('#2A2D2F','stock-humayunbd'), | |
), | |
array( | |
'id' => 'footer_text_color', | |
'type' => 'color_picker', | |
'title' => esc_html__('Footer text color','stock-humayunbd'), | |
'default' => esc_attr__('#afb9c0','stock-humayunbd'), | |
), | |
array( | |
'id' => 'footer_heading_color', | |
'type' => 'color_picker', | |
'title' => esc_html__('Footer heading color','stock-humayunbd'), | |
'default' => esc_attr__('#ffffff','stock-humayunbd'), | |
), | |
array( | |
'id' => 'footer_copyright_text', | |
'type' => 'textarea', | |
'title' => esc_html__('Footer copyright text','stock-humayunbd'), | |
'default' => esc_html__('Copyright - 2018 FairDealLab - All Rights Reserved','stock-humayunbd'), | |
), | |
) | |
); | |
// Script Setting | |
$options[] = array( | |
'name' => 'stock_humayunbd_scripts_settings', | |
'title' => esc_html__('Scripts settings','stock-humayunbd'), | |
'icon' => 'fa fa-heart', | |
'fields' => array( | |
array( | |
'id' => 'head_scripts', | |
'type' => 'textarea', | |
'sanitize' => false, | |
'title' => esc_html__('Head script','stock-humayunbd'), | |
'desc' => esc_html__('Scripts will be included before closing < / head >','stock-humayunbd'), | |
), | |
array( | |
'id' => 'body_end_scripts', | |
'type' => 'textarea', | |
'sanitize' => false, | |
'title' => esc_html__('Footer script','stock-humayunbd'), | |
'desc' => esc_html__('Scripts will be included before < / body >','stock-humayunbd'), | |
), | |
array( | |
'id' => 'stock_custom_css', | |
'type' => 'textarea', | |
'sanitize' => false, | |
'title' => esc_html__('Custom CSS','stock-humayunbd'), | |
'desc' => esc_html__('Add your custom CSS','stock-humayunbd'), | |
), | |
) | |
); | |
return $options; | |
} | |
add_filter( 'cs_framework_options', 'stock_humayunbd_options' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment