Skip to content
This repository has been archived by the owner. It is now read-only.

Add theme stylesheet options in customizer #35

Merged
merged 1 commit into from Dec 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
107 changes: 17 additions & 90 deletions functions.php
Expand Up @@ -5,17 +5,6 @@
*
*/

// any custom js or css

function sherman_scripts() {
wp_enqueue_script( 'sherman-js', get_stylesheet_directory_uri() . '/javascripts/min/sherman.min.js', array( 'jquery' ));
}

add_action( 'wp_enqueue_scripts', 'sherman_scripts');




// Remove the Header Image Feature

function sherman_remove_theme_features() {
Expand All @@ -26,106 +15,44 @@ function sherman_remove_theme_features() {
add_action( 'init', 'sherman_remove_theme_features' );

function sherman_customize_register( $wp_customize ) {
$wp_customize->remove_section('colors');
//$wp_customize->remove_section('colors');
$wp_customize->remove_section('background_image');
$wp_customize->remove_section('nav');
}
add_action( 'customize_register', 'sherman_customize_register' );






// Add Options for Sherman-specific Color options.
/*

function sherman_titlebar_register( $wp_customize ){

$wp_customize->add_setting( 'titlebarColor', //Give it a SERIALIZED name (so all theme settings can live under one db record)
$wp_customize->add_setting( 'themeColor', //Give it a SERIALIZED name (so all theme settings can live under one db record)
array(
'default' => 'lightgrey', //Default setting/value to save
'default' => 'sherman-default', //Default setting/value to save
'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'?
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'refresh'
)
);
$wp_customize->add_control('titlebarColor', array(
$wp_customize->add_control('themeColor', array(
'type' => 'radio',
'label' => 'Titlebar Color',
'label' => 'Stylesheet',
'section' => 'colors',
'choices' => array(
'blue'=>'Blue',
'red'=>'Red',
'black' => 'Black',
'darkgrey' => 'Dark Grey',
'lightgrey' => 'Light Grey',
'white' => 'White'
)
)
);
$wp_customize->add_setting( 'navColor', //Give it a SERIALIZED name (so all theme settings can live under one db record)
array(
'default' => 'lightgrey', //Default setting/value to save
'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'?
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'refresh'
)
);
$wp_customize->add_control('navColor', array(
'type' => 'radio',
'label' => 'Navigation Color',
'section' => 'colors',
'choices' => array(
'blue'=>'Blue',
'red'=>'Red',
'black' => 'Black',
'darkgrey' => 'Dark Grey',
'lightgrey' => 'Light Grey',
'white' => 'White'
)
)
);
$wp_customize->add_setting( 'contentColor', //Give it a SERIALIZED name (so all theme settings can live under one db record)
array(
'default' => 'standard', //Default setting/value to save
'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'?
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'refresh'
)
);
$wp_customize->add_control('contentColor', array(
'type' => 'radio',
'label' => 'Text Colors',
'section' => 'colors',
'choices' => array(
'standard'=>'Standard',
'reverse'=>'Reverse'
)
)
);
$wp_customize->add_setting( 'footColor', //Give it a SERIALIZED name (so all theme settings can live under one db record)
array(
'default' => 'lightgrey', //Default setting/value to save
'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'?
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'refresh'
)
);
$wp_customize->add_control('footColor', array(
'type' => 'radio',
'label' => 'Footer Color',
'section' => 'colors',
'choices' => array(
'blue'=>'Blue',
'red'=>'Red',
'black' => 'Black',
'darkgrey' => 'Dark Grey',
'lightgrey' => 'Light Grey',
'white' => 'White'
'sherman-default' => 'Sherman Default',
'sherman-red' => 'Sherman Red',
'sherman-black' => 'Sherman Black',
)
)
);
}
add_action( 'customize_register', 'sherman_titlebar_register' , 34);
*/

function sherman_scripts() {
wp_enqueue_script( 'sherman-js', get_stylesheet_directory_uri() . '/javascripts/min/sherman.min.js', array( 'jquery' ));
$stylesheet = get_theme_mod('themeColor');
wp_enqueue_style( $stylesheet, get_stylesheet_directory_uri() . '/stylesheets/'.$stylesheet.'.css', array('cs-style') );
}

add_action( 'wp_enqueue_scripts', 'sherman_scripts');
?>
3 changes: 3 additions & 0 deletions stylesheets/sherman-default.css
@@ -0,0 +1,3 @@
/*
Sample css file, just to check if customizer stylesheet picking works
*/