Created
September 4, 2015 13:00
-
-
Save MarcGuay/5c1bd8ab2a17027297f4 to your computer and use it in GitHub Desktop.
get_theme_mods() vs get_theme_mod()
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
// wp-content/themes/twentyfifteen/inc.customizer.php | |
$wp_customize->add_setting( 'test-color', array( | |
'default' => '#f72525', | |
'sanitize_callback' => 'sanitize_hex_color', | |
) ); | |
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'test-color', array( | |
'label' => __( 'Test Color', 'twentyfifteen' ), | |
'section' => 'colors', | |
) ) ); | |
// wp-content/themes/twentyfifteen/header.php | |
$theme_mods = get_theme_mods(); | |
echo "<pre>"; | |
var_dump($theme_mods); | |
echo "test-color: ". get_theme_mod('test-color'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment