Last active
December 22, 2017 12:39
-
-
Save rachelmccollin/5e4c15d29e9e97307266fcdfe6b0b3f6 to your computer and use it in GitHub Desktop.
WPMU DEV Adding Styling via the Customizer Without Adding CSS to the Page
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 | |
function wpmu_customize_register( $wp_customize ) { | |
} | |
add_action( 'customize_register', 'wpmu_customize_register' ); |
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
/******************************************* | |
Section | |
********************************************/ | |
// colors section | |
$wp_customize->add_section( 'wpmu_colors' , array( | |
'title' => __( 'Colors', 'wpmu') | |
) ); |
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
/******************************************* | |
Color settings | |
********************************************/ | |
//logo position | |
$wp_customize->add_setting( 'wpmu_nav_color' ); | |
$wp_customize->add_control( 'wpmu_nav_color', array ( | |
'label' => 'Navigation Menu Color', | |
'section' => 'wpmu_colors', | |
'settings' => 'wpmu_header_color', | |
'type' => 'radio', | |
'choices' => array( | |
'blue' => __( 'Blue', 'wpmu' ), | |
'red' => __( 'Red', 'wpmu' ), | |
'green' => __( 'Green', 'wpmu' ), | |
) | |
)); |
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
include( get_stylesheet_directory() . '/includes/customizer.php' ); |
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
nav.main.blue | |
nav.main.blue a { | |
background: #312d72; | |
} | |
nav.main.red, | |
nav.main.red a { | |
background: #8b1b1b; | |
} | |
nav.main.green, | |
nav.main.green a { | |
background: #0e4813; | |
} |
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
function wpmu_header_color( $header_color ) { | |
$header_color = get_theme_mod( 'wpmu_header_color', 'blue' ); | |
return $header_color; | |
} | |
add_filter( 'wpmu_header_color_css' , 'wpmu_header_color' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment