Skip to content

Instantly share code, notes, and snippets.

@thefrosty
Created February 22, 2016 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefrosty/8db3b18e91ba45b050ec to your computer and use it in GitHub Desktop.
Save thefrosty/8db3b18e91ba45b050ec to your computer and use it in GitHub Desktop.
Basic WordPress customizer setting.
<?php
namespace Passy;
add_action( 'customize_register', __NAMESPACE__ . '\\customize_register' );
function customize_register( WP_Customize_Manager $wp_customize ) {
$wp_customize->add_panel( 'custom_login_settings',
array(
'priority' => 10,
'capability' => 'manage_options',
'title' => __( 'Custom Login', 'custom-login' ),
'description' => __( 'Style your wp-login.php page with ease.', 'custom-login' ),
)
);
$wp_customize->add_section(
'custom_login_form',
array(
'title' => __( 'Custom Login Form', 'custom-login',
'panel' => 'custom_login_settings', // WordPress 4.3
'capability' => 'manage_options', // If different then the panel 'capability'
'priority' => 10,
)
);
$wp_customize->add_setting(
'form_background',
array(
'default' => '',
'type' => 'option', // this is a option not a theme mod AKA get_option()
'capability' => 'manage_options',
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'form_background',
array(
'label' => __( 'Form Background Color', 'custom-login' ),
'section' => 'custom_login_form',
'settings' => 'custom_login_settings["design"]',
)
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment