Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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(
- array(
- 'name' => 'stock_page_options_meta',
- 'fields' => array(
- array(
- 'id' => 'enable_title',
- 'type' => 'switcher',
- 'title' => esc_html__('Enable title?', 'stock-theme'),
- 'desc' => esc_html__('If you want to enable title, select yes.', 'stock-theme')
- ),
- array(
- 'id' => 'custom_title',
- 'type' => 'text',
- 'title' => esc_html__('Custom title', 'stock-theme'),
- 'dependency' => array( 'enable_title', '==', 'true' ),
- 'desc' => esc_html__('If you want to enable title, select yes.', 'stock-theme')
- ),
- ),
- ),
- ),
- );
- // Slide options
- $options[] = array(
- 'id' => 'stock_slide_options',
- 'title' => esc_html__('Slide Options', 'stock-theme'),
- 'post_type' => 'slide',
- 'context' => 'normal',
- 'priority' => 'high',
- 'sections' => array(
- array(
- 'name' => 'stock_slide_options_meta',
- 'fields' => array(
- array(
- 'id' => 'buttons',
- 'type' => 'group',
- 'title' => esc_html__( 'Slides button', 'stock-theme' ),
- 'button_title' => esc_html__( 'Add New' ),
- 'accordion_title' => esc_html__( 'Add New Field' ),
- 'fields' => array(
- array(
- 'id' => 'type',
- 'type' => 'select',
- 'desc' => 'select button type',
- 'options' => array(
- 'bordered' => 'Bordered button',
- 'filled' => 'Filled button',
- ),
- 'title' => esc_html__( 'Button type', 'stock-theme' ),
- ),
- array(
- 'id' => 'text',
- 'type' => 'text',
- 'desc' => 'type button text',
- 'title' => esc_html__( 'Button text', 'stock-theme' ),
- 'default' => 'Get a free consultation',
- ),
- array(
- 'id' => 'link_type',
- 'type' => 'select',
- 'desc' => 'select link type',
- 'title' => esc_html__( 'Link type', 'stock-theme' ),
- 'options' => array(
- '1' => 'WordPress Page',
- '2' => 'External link',
- ),
- ),
- array(
- 'id' => 'link_to_page',
- 'type' => 'select',
- 'desc' => 'select wordpress page',
- 'title' => esc_html__( 'Select page', 'stock-theme' ),
- 'options' => 'page',
- 'dependency' => array( 'link_type', '==', '1' ),
- ),
- array(
- 'id' => 'link_to_external',
- 'type' => 'text',
- 'desc' => 'type external url',
- 'title' => esc_html__( 'Type URL', 'stock-theme' ),
- 'dependency' => array( 'link_type', '==', '2' ),
- ),
- ),
- ),
- // start enable overlay field
- array(
- 'id' => 'enable_overlay',
- 'type' => 'switcher',
- 'title' => esc_html__('Enable overlay'),
- 'desc' => 'if you want to enable overlay, select yes.',
- 'default' => true,
- ),
- // start overlay percentage field
- array(
- 'id' => 'overlay_percentage',
- 'type' => 'text',
- 'default' => '.6',
- 'title' => esc_html__('Overlay percentage'),
- 'desc' => 'Type overlay percentage in floating number. Max value is 1.',
- 'dependency' => array('enable_overlay', '==', 'true' )
- ),
- // start overlay color field
- array(
- 'id' => 'overlay_color',
- 'type' => 'color_picker',
- 'title' => esc_html__('Overlay Color'),
- 'desc' => 'Select your overlay color',
- 'default' => '#181a1f',
- 'dependency' => array('enable_overlay', '==', 'true' )
- ),
- ),
- ),
- ),
- );
- return $options;
- }
- add_filter( 'cs_metabox_options', 'stock_theme_metabox' );
- // Theme options
- function stock_theme_options($options) {
- $options = array(); // remove old options
- $options[] = array(
- 'name' => 'stock_theme_header_settings',
- 'title' => 'Header settings',
- 'icon' => 'fa fa-heart',
- 'fields' => array(
- array(
- 'id' => 'header_iconic_boxes',
- 'type' => 'group',
- 'title' => 'Iconic boxes',
- 'button_title' => 'Add New',
- 'accordion_title' => 'Add New box',
- 'fields' => array(
- array(
- 'id' => 'title',
- 'type' => 'text',
- 'title' => 'Title',
- ),
- array(
- 'id' => 'icon',
- 'type' => 'icon',
- 'title' => 'Box icon',
- 'desc' => 'Select box icon',
- ),
- array(
- 'id' => 'big_title',
- 'type' => 'text',
- 'title' => 'Big title',
- ),
- ),
- ),
- )
- );
- $options[] = array(
- 'name' => 'stock_theme_social_settings',
- 'title' => 'Social links',
- 'icon' => 'fa fa-heart',
- 'fields' => array(
- array(
- 'id' => 'social_links',
- 'type' => 'group',
- 'title' => 'Social links',
- 'button_title' => 'Add New',
- 'accordion_title' => 'Add New link',
- 'fields' => array(
- array(
- 'id' => 'icon',
- 'type' => 'icon',
- 'title' => 'Icon',
- 'desc' => 'Select icon',
- ),
- array(
- 'id' => 'link',
- 'type' => 'text',
- 'title' => 'Link text',
- ),
- ),
- ),
- )
- );
- $options[] = array(
- 'name' => 'stock_theme_logo_settings',
- 'title' => 'Logo settings',
- 'icon' => 'fa fa-heart',
- 'fields' => array(
- array(
- 'id' => 'enable_image_logo',
- 'type' => 'switcher',
- 'default' => false,
- 'title' => 'Enable image logo',
- ),
- array(
- 'id' => 'image_logo',
- 'type' => 'image',
- 'title' => 'Upload image logo',
- 'dependency' => array('enable_image_logo', '==', true),
- ),
- array(
- 'id' => 'text_logo',
- 'type' => 'text',
- 'title' => 'Logo text',
- 'default' => 'Stock',
- 'dependency' => array('enable_image_logo', '==', false),
- ),
- )
- );
- $options[] = array(
- 'name' => 'stock_theme_typography_settings',
- 'title' => 'Typography settings',
- 'icon' => 'fa fa-heart',
- 'fields' => array(
- array(
- 'id' => 'body_font',
- 'type' => 'typography',
- 'title' => 'Body font',
- 'default' => array(
- 'family' => 'Roboto',
- 'variant' => 'regular',
- 'font' => 'google', // this is helper for output
- ),
- ),
- array(
- 'id' => 'heading_font',
- 'type' => 'typography',
- 'title' => 'Heading font',
- 'default' => array(
- 'family' => 'Noto Serif',
- 'variant' => '700',
- 'font' => 'google', // this is helper for output
- ),
- ),
- )
- );
- $options[] = array(
- 'name' => 'stock_theme_styling_settings',
- 'title' => 'Styling settings',
- 'icon' => 'fa fa-heart',
- 'fields' => array(
- array(
- 'id' => 'enable_preloader',
- 'type' => 'switcher',
- 'title' => 'Enable preloader',
- 'default' => true,
- ),
- array(
- 'id' => 'enable_boxed_layout',
- 'type' => 'switcher',
- 'title' => 'Enable boxed layout',
- 'default' => false,
- ),
- array(
- 'id' => 'body_bg',
- 'type' => 'image',
- 'title' => 'Body background image',
- 'dependency' => array('enable_boxed_layout', '==', true),
- ),
- array(
- 'id' => 'body_bg_repeat',
- 'type' => 'select',
- 'title' => 'Body background repeat',
- 'options' => array(
- 'repeat' => 'Repeat',
- 'no-repeat' => 'No-repeat',
- 'cover' => 'Cover',
- ),
- 'default' => 'repeat',
- 'dependency' => array('enable_boxed_layout', '==', true),
- ),
- array(
- 'id' => 'body_bg_attachment',
- 'type' => 'select',
- 'title' => 'Body background attachment',
- 'options' => array(
- 'scroll' => 'Scroll',
- 'fixed' => 'Fixed',
- ),
- 'default' => 'scroll',
- 'dependency' => array('enable_boxed_layout', '==', true),
- ),
- )
- );
- $options[] = array(
- 'name' => 'stock_theme_blog_settings',
- 'title' => 'Blog settings',
- 'icon' => 'fa fa-heart',
- 'fields' => array(
- array(
- 'id' => 'display_post_by',
- 'type' => 'switcher',
- 'title' => 'Display post by?',
- 'default' => true,
- ),
- array(
- 'id' => 'display_post_date',
- 'type' => 'switcher',
- 'title' => 'Display post date?',
- 'default' => true,
- ),
- array(
- 'id' => 'display_post_comment_count',
- 'type' => 'switcher',
- 'title' => 'Display comment count?',
- 'default' => true,
- ),
- array(
- 'id' => 'display_post_category',
- 'type' => 'switcher',
- 'title' => 'Display posted in categories?',
- 'default' => true,
- ),
- array(
- 'id' => 'display_post_tag',
- 'type' => 'switcher',
- 'title' => 'Display posted in tags?',
- 'default' => true,
- ),
- array(
- 'id' => 'display_post_nav',
- 'type' => 'switcher',
- 'title' => 'Display next previous link on single post?',
- 'default' => true,
- ),
- )
- );
- $options[] = array(
- 'name' => 'stock_theme_footer_settings',
- 'title' => 'Footer settings',
- 'icon' => 'fa fa-heart',
- 'fields' => array(
- array(
- 'id' => 'footer_bg',
- 'type' => 'color_picker',
- 'title' => 'Footer background color',
- 'default' => '#2a2d2f',
- ),
- array(
- 'id' => 'footer_text_color',
- 'type' => 'color_picker',
- 'title' => 'Footer text color',
- 'default' => '#8e9397',
- ),
- array(
- 'id' => 'footer_heading_color',
- 'type' => 'color_picker',
- 'title' => 'Footer heading color',
- 'default' => '#ffffff',
- ),
- array(
- 'id' => 'footer_copyright_text',
- 'type' => 'textarea',
- 'title' => 'Footer copyright text',
- 'default' => 'Copyright © 2017 FairDealLab - All Rights Reserved',
- ),
- )
- );
- $options[] = array(
- 'name' => 'stock_theme_scripts_settings',
- 'title' => 'Script settings',
- 'icon' => 'fa fa-heart',
- 'fields' => array(
- array(
- 'id' => 'head_scripts',
- 'type' => 'textarea',
- 'title' => 'Head scripts',
- 'sanitize' => false,
- 'desc' => 'Scripts goes before closing head tag.'
- ),
- array(
- 'id' => 'body_scripts',
- 'type' => 'textarea',
- 'title' => 'Body scripts',
- 'sanitize' => false,
- 'desc' => 'Scripts goes after opening body tag.'
- ),
- array(
- 'id' => 'body_end_scripts',
- 'type' => 'textarea',
- 'title' => 'Footer scripts',
- 'sanitize' => false,
- 'desc' => 'Scripts goes before closing body tag.'
- ),
- )
- );
- return $options;
- }
- add_filter( 'cs_framework_options', 'stock_theme_options' );
Add Comment
Please, Sign In to add comment