Last active
October 12, 2016 06:02
-
-
Save jessicahawkins3344/a709a62720b94ac3ae7a6dc6c0d81c58 to your computer and use it in GitHub Desktop.
Customizer-Options Sample for Customizer Library
This file contains hidden or 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 | |
/** | |
* Defines customizer options | |
* | |
* @package Customizer Library Demo | |
*/ | |
function customizer_library_demo_options() { | |
// Theme defaults | |
$brand_primary = '#02c0a7'; | |
$brand_success = '#FF4A4F'; | |
$brand_secondary = '#f1c40f'; | |
$brand_info = '#B5BC18'; | |
$c_gray = '#404040'; | |
// Stores all the controls that will be added | |
$options = array(); | |
// Stores all the sections to be added | |
$sections = array(); | |
$panels = array(); | |
// Stores all the controls to be added | |
$control = array(); | |
// Adds the sections to the $options array | |
$options['sections'] = $sections; | |
/*///////////////////////////////// | |
/* Sections & Section Panels | |
/*///////////////////////////////// | |
$panel = 'header-navbar'; | |
$panels[] = array( | |
'id' => $panel, | |
'title' => __( 'Theme Logo & Nav', 'demo' ), | |
'priority' => '0' | |
); | |
$section = 'colors_type'; | |
$sections[] = array( | |
'id' => $section, | |
'title' => __( 'Theme Colors', 'demo' ), | |
'priority' => '0' | |
); | |
$section = 'typography'; | |
$font_choices = customizer_library_get_font_choices(); | |
$sections[] = array( | |
'id' => $section, | |
'title' => __( 'Theme Typography', 'demo' ), | |
'priority' => '0' | |
); | |
$section = 'social'; | |
$sections[] = array( | |
'id' => $section, | |
'title' => __( 'Theme Social Links', 'demo' ), | |
'priority' => '0' | |
); | |
$section = 'footer'; | |
$sections[] = array( | |
'id' => $section, | |
'title' => __( 'Theme Footer', 'demo' ), | |
'priority' => '0' | |
); | |
/*///////////////////////////////// | |
/* Logo & NavSub Sub Sections | |
/*///////////////////////////////// | |
$section = 'logo'; | |
$sections[] = array( | |
'id' => $section, | |
'title' => __( 'Navbar Logo & Color', 'demo' ), | |
'description' => __( 'Control your header\'s logo, colors, and link colors' , 'demo' ), // @TODO Put a helper here | |
'priority' => '30', | |
'panel' => 'header-navbar' | |
); | |
$section = 'header-scripts'; | |
$sections[] = array( | |
'id' => $section, | |
'title' => __( 'Additional Scripts', 'demo' ), | |
'description' => __( 'Analytics Scripts & Custom Scripts' , 'demo' ), // @TODO Put a helper here | |
'priority' => '60', | |
'panel' => 'header-navbar' | |
); | |
/*///////////////////////////////// | |
/* Options Logo & Nav | |
/*///////////////////////////////// | |
$options['logo'] = array( | |
'id' => 'logo', | |
'label' => __( 'Logo', 'demo' ), | |
'section' => 'logo', | |
'type' => 'image', | |
'default' => '' | |
); | |
$options['add-scripts'] = array( | |
'id' => 'add-scripts', | |
'label' => __( 'Custom Scripts for Header', 'demo' ), | |
'section' => 'header-scripts', | |
'type' => 'textarea', | |
); | |
/*///////////////////////////////// | |
/* Options Colors & Typography | |
/*///////////////////////////////// | |
$options['primary-font'] = array( | |
'id' => 'primary-font', | |
'label' => __( 'Primary Font', 'demo' ), | |
'section' => 'typography', | |
'type' => 'select', | |
'choices' => $font_choices, | |
'default' => 'Monoton' | |
); | |
$options['secondary-font'] = array( | |
'id' => 'secondary-font', | |
'label' => __( 'Script, Decorative Font using the .script class', 'demo' ), | |
'section' => 'typography', | |
'type' => 'select', | |
'choices' => $font_choices, | |
'default' => 'Merriweather' | |
); | |
$options['body_font_color'] = array( | |
'id' => 'body_font_color', | |
'label' => __( 'Base Font Color', 'demo' ), | |
'section' => 'typography', | |
'type' => 'color', | |
'default' => $c_gray, | |
); | |
$options['body_background'] = array( | |
'id' => 'body_background', | |
'label' => __( 'Base Background Color', 'demo' ), | |
'section' => 'colors_type', | |
'type' => 'color', | |
'default' => '#fffff', | |
); | |
$options['brand-primary'] = array( | |
'id' => 'brand-primary', | |
'label' => __( 'Brand Primary', 'demo' ), | |
'description' => __( 'Filled Buttons, Icons, and elements using the ".primary-bg or .brand-primary" class' , 'demo' ), // @TODO Put a helper here | |
'section' => 'colors_type', | |
'type' => 'color', | |
'default' => $brand_primary, | |
); | |
$options['brand-secondary'] = array( | |
'id' => 'brand-secondary', | |
'label' => __( 'Brand Secondary', 'demo' ), | |
'description' => __( 'Filled Buttons, Icons, and elements using the ".secondary-bg or .brand-secondary" class' , 'demo' ), // @TODO Put a helper here | |
'section' => 'colors_type', | |
'type' => 'color', | |
'default' => $brand_secondary, | |
); | |
$options['brand-success'] = array( | |
'id' => 'brand-success', | |
'label' => __( 'Brand Success', 'demo' ), | |
'description' => __( 'Filled Buttons, Icons, and elements using the ".success-bg or .brand-success" class' , 'demo' ), // @TODO Put a helper here | |
'section' => 'colors_type', | |
'type' => 'color', | |
'default' => $brand_success, | |
); | |
$options['brand-info'] = array( | |
'id' => 'brand-info', | |
'label' => __( 'Brand Info', 'demo' ), | |
'description' => __( 'Filled Buttons, Icons, and elements using the ".info-bg or .brand-info" class' , 'demo' ), // @TODO Put a helper here | |
'section' => 'colors_type', | |
'type' => 'color', | |
'default' => $brand_info, | |
); | |
/*///////////////////////////////// | |
/* Options - Social | |
/*///////////////////////////////// | |
$options['c-facebook'] = array( | |
'id' => 'c-facebook', | |
'label' => __( 'Include Facebook Profile', 'textdomain' ), | |
'section' => 'social', | |
'type' => 'checkbox', | |
'default' => 0, | |
); | |
$options['c-twitter'] = array( | |
'id' => 'c-twitter', | |
'label' => __( 'Include Twitter Profile', 'textdomain' ), | |
'section' => 'social', | |
'type' => 'checkbox', | |
'default' => 0, | |
); | |
$options['c-google'] = array( | |
'id' => 'c-google', | |
'label' => __( 'Include Google+ Profile', 'textdomain' ), | |
'section' => 'social', | |
'type' => 'checkbox', | |
'default' => 0, | |
); | |
$options['f-facebook'] = array( | |
'id' => 'f-facebook', | |
'label' => __( 'Facebook URL', 'demo' ), | |
'description' => __( 'Your Facebook URL starting with "http://"...' , 'demo' ), // @TODO Put a helper here | |
'section' => 'social', | |
'type' => 'url', | |
); | |
$options['f-twitter'] = array( | |
'id' => 'f-twitter', | |
'label' => __( 'Twitter URL', 'demo' ), | |
'description' => __( 'Your Twitter URL starting with "http://"...' , 'demo' ), // @TODO Put a helper here | |
'section' => 'social', | |
'type' => 'url', | |
); | |
$options['f-google'] = array( | |
'id' => 'f-google', | |
'label' => __( 'Google Plus URL', 'demo' ), | |
'description' => __( 'Your Plus URL starting with "http://"...' , 'demo' ), // @TODO Put a helper here | |
'section' => 'social', | |
'type' => 'url', | |
); | |
$options['f-linkedin'] = array( | |
'id' => 'f-linkedin', | |
'label' => __( 'LinkedIn URL', 'demo' ), | |
'description' => __( 'Your LinkedIn URL starting with "http://"...' , 'demo' ), // @TODO Put a helper here | |
'section' => 'social', | |
'type' => 'url', | |
); | |
$options['f-youtube'] = array( | |
'id' => 'f-youtube', | |
'label' => __( 'YouTube URL', 'demo' ), | |
'description' => __( 'Your YouTube Channel URL starting with "http://"...' , 'demo' ), // @TODO Put a helper here | |
'section' => 'social', | |
'type' => 'url', | |
); | |
$options['f-rss'] = array( | |
'id' => 'f-rss', | |
'label' => __( 'RSS URL', 'demo' ), | |
'description' => __( 'Your RSS URL starting with "http://"...' , 'demo' ), // @TODO Put a helper here | |
'section' => 'social', | |
'type' => 'url', | |
); | |
/*///////////////////////////////// | |
/* Options - Footer | |
/*///////////////////////////////// | |
$options['f-copyright'] = array( | |
'id' => 'f-copyright', | |
'label' => __( 'Copyright Line', 'demo' ), | |
'description' => __( 'The Footer Copyright Line' , 'demo' ), // @TODO Put a helper here | |
'section' => 'footer', | |
'type' => 'text' | |
); | |
// Adds the sections to the $options array | |
$options['sections'] = $sections; | |
// Adds the panels to the $options array | |
$options['panels'] = $panels; | |
$customizer_library = Customizer_Library::Instance(); | |
$customizer_library->add_options( $options ); | |
// To delete custom mods use: customizer_library_remove_theme_mods(); | |
} | |
add_action( 'init', 'customizer_library_demo_options' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment