Skip to content

Instantly share code, notes, and snippets.

@hsleonis
Created March 30, 2016 08:43
Show Gist options
  • Select an option

  • Save hsleonis/6b149f7dc812371f6806037e62d06abc to your computer and use it in GitHub Desktop.

Select an option

Save hsleonis/6b149f7dc812371f6806037e62d06abc to your computer and use it in GitHub Desktop.
WP theme customizer section
<?php
/**
* Adds the individual sections, settings, and controls to the theme customizer
* Reference: https://codex.wordpress.org/Theme_Customization_API
*/
function tmx_theme_customizer( $wp_customize ) {
$wp_customize->add_section(
'social_section',
array(
'title' => 'Social Links',
'description' => 'Social site URL settings.',
'priority' => 35,
)
);
$wp_customize->add_setting(
'fb_txt_link',
array(
'default' => 'http://facebook.com',
)
);
$wp_customize->add_control(
'fb_txt_link',
array(
'label' => 'Facebook URL',
'section' => 'social_section',
'type' => 'text',
)
);
$wp_customize->add_setting(
'tw_txt_link',
array(
'default' => 'http://twitter.com',
)
);
$wp_customize->add_control(
'tw_txt_link',
array(
'label' => 'Twitter URL',
'section' => 'social_section',
'type' => 'text',
)
);
}
add_action( 'customize_register', 'tmx_theme_customizer' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment