Last active
November 7, 2017 12:37
-
-
Save yuriitaran/06e5da4dfb669e3d2396d380aff3d70b to your computer and use it in GitHub Desktop.
WP Theme Options
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
/** | |
* Theme Options | |
*/ | |
add_action('customize_register', function($wp_customize) { | |
/** | |
* Add Custom Logo | |
*/ | |
$wp_customize->add_setting('logo_img'); | |
$wp_customize->add_control( | |
new WP_Customize_Image_Control( | |
$wp_customize, | |
'logo_img', | |
array( | |
'label' => 'Logo', | |
'section' => 'title_tagline', | |
'settings' => 'logo_img' | |
) | |
) | |
); | |
/** | |
* Add Section for Design Settings | |
*/ | |
$wp_customize->add_section( | |
'design_section', | |
array( | |
'title' => 'Design', | |
'description' => 'Visual settings', | |
'priority' => 71, | |
// 'panel' => 'design_option_panel', | |
) | |
); | |
/** | |
* Add Custom Background | |
*/ | |
$wp_customize->add_setting('background_img'); | |
$wp_customize->add_control( | |
new WP_Customize_Image_Control( | |
$wp_customize, | |
'background_img', | |
array( | |
'label' => 'Background image', | |
'section' => 'design_section', | |
'settings' => 'background_img' | |
) | |
) | |
); | |
/** | |
* Add Section for Footer Settings | |
*/ | |
$wp_customize->add_section( | |
'footer_section', | |
array( | |
'title' => 'Footer', | |
'description' => 'Bottom logo and copyright', | |
'priority' => 71, | |
// 'panel' => 'design_option_panel', | |
) | |
); | |
/** | |
* Add Custom Bottom Logo | |
*/ | |
$wp_customize->add_setting('bottom_logo'); | |
$wp_customize->add_control( | |
new WP_Customize_Image_Control( | |
$wp_customize, | |
'bottom_logo', | |
array( | |
'label' => 'Bottom logo', | |
'section' => 'footer_section', | |
'settings' => 'bottom_logo' | |
) | |
) | |
); | |
/** | |
* Add Copyright | |
*/ | |
$wp_customize->add_setting( | |
'copyright_text', | |
array('default' => '') | |
); | |
$wp_customize->add_control( | |
'copyright_text', | |
array( | |
'label' => 'Copyright Text', | |
'section' => 'footer_section', | |
'type' => 'text', | |
) | |
); | |
// echo (get_theme_mod('copyright_text') ? get_theme_mod('copyright_text') : bloginfo('name')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment