Skip to content

Instantly share code, notes, and snippets.

@EastSideCode
Created September 15, 2018 17:41
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 EastSideCode/1ee753edd367fb1f84db1726715b4ead to your computer and use it in GitHub Desktop.
Save EastSideCode/1ee753edd367fb1f84db1726715b4ead to your computer and use it in GitHub Desktop.
Add a setting to WordPress customizer
// This example is for a section called theme options, with a setting for copyright text
$wp_customize->add_section( 'theme_options_section' , array(
'title' => __('Theme Options','themename'),
'priority' => 30,
) );
$wp_customize->add_setting( 'copyright_text' , array(
'default' => 'Default text here'
) );
$wp_customize->add_control(
'copyright_setting',
array(
'label' => __( 'Copyright Text', 'themename' ),
'section' => 'theme_options_section',
'settings' => 'copyright_text',
'type' => 'textarea'
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment