Skip to content

Instantly share code, notes, and snippets.

@jackperry
Created August 13, 2015 03:54
Show Gist options
  • Save jackperry/20bf6af1c30c22f53bb5 to your computer and use it in GitHub Desktop.
Save jackperry/20bf6af1c30c22f53bb5 to your computer and use it in GitHub Desktop.
<?php
/*******************************
* Adds support in the customizer
*******************************/
function cyprinus_theme_customizer( $wp_customize ) {
//images tab
$wp_customize->add_section( 'cyprinus_images_section', array(
'title' => __( 'Images', 'cyprinus' ),
'description' => 'Update images banner',
) );
// add hero background image
$wp_customize->add_setting( 'cyprinus_hero_image', array(
'default' => get_template_directory_uri() .'/images/church.jpg',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'cyprinus_hero_image', array(
'label' => __( 'Hero background', 'cyprinus' ),
'section' => 'cyprinus_images_section',
'settings' => 'cyprinus_hero_image',
) ) );
// add hero overlay image
$wp_customize->add_setting( 'cyprinus_hero_overlay_image', array(
'default' => get_template_directory_uri() .'/images/hero_overlay.jpg',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'cyprinus_hero_overlay_image', array(
'label' => __( 'Hero Overlay', 'cyprinus' ),
'section' => 'cyprinus_images_section',
'settings' => 'cyprinus_hero_overlay_image',
) ) );
//footer tab
$wp_customize->add_section( 'cyprinus_copyright_section', array(
'title' => __( 'Footer', 'cyprinus' ),
'description' => 'Update footer content',
) );
// add copyright
$wp_customize->add_setting( 'cyprinus_copyright_content', array(
'default' => '&copy; simplewebsiteinaday.com.au',
) );
$wp_customize->add_control( 'cyprinus_copyright_content', array(
'label' => __( 'Copyright', 'cyprinus' ),
'section' => 'cyprinus_copyright_section',
'settings' => 'cyprinus_copyright_content',
'type' => 'text',
) );
//advanced tab
$wp_customize->add_section( 'cyprinus_advanced_section', array(
'title' => __( 'Advanced', 'cyprinus' ),
'description' => 'Add custom css and scripts',
) );
// add custom css
$wp_customize->add_setting( 'cyprinus_css_content', array(
'default' => '',
) );
$wp_customize->add_control( 'cyprinus_css_content', array(
'label' => __( 'CSS', 'cyprinus' ),
'section' => 'cyprinus_advanced_section',
'settings' => 'cyprinus_css_content',
'type' => 'textarea',
) );
// add header script
$wp_customize->add_setting( 'cyprinus_header_script_content', array(
'default' => '',
) );
$wp_customize->add_control( 'cyprinus_header_script_content', array(
'label' => __( 'Header Script', 'cyprinus' ),
'section' => 'cyprinus_advanced_section',
'settings' => 'cyprinus_header_script_content',
'type' => 'textarea',
) );
// add footer script
$wp_customize->add_setting( 'cyprinus_footer_script_content', array(
'default' => '',
) );
$wp_customize->add_control( 'cyprinus_footer_script_content', array(
'label' => __( 'Footer Script', 'cyprinus' ),
'section' => 'cyprinus_advanced_section',
'settings' => 'cyprinus_footer_script_content',
'type' => 'textarea',
) );
}
add_action( 'customize_register', 'cyprinus_theme_customizer' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment