WordPress comes with a built-in theme customizer that allows to take your WordPress Theme to the next level. Using Customizer you can change your Site Title and Tagline, add Widgets to a Sidebar or Footer, create Custom Menus, change your Homepage Settings, and more with realtime view.
For example we are going to create a panel “Social Links” then can be accessible from Dashboard go Apearance->Customize. For thiswe have put the code given below in your theme’s functions.php
function theme_customize_function($wp_customize){ $wp_customize->add_panel('sp_social_url',array( 'title'=>'Social Icons', 'description'=> 'Set Social Media Url here', 'priority'=> 100, )); $wp_customize->add_section('sp_social_url',array( 'title'=>'Social Url', 'description'=>__('Set Social Media Url here'), 'panel'=>'sp_social_url', )); $wp_customize->add_setting('sp_social_facebook',array( 'default'=>_('Facebook Url'), )); $wp_customize->add_control('sp_social_facebook',array( 'label'=>'Facebook Url', 'section'=>__('sp_social_url'), 'priority'=>1, )); $wp_customize->add_setting('sp_social_youtube',array( 'default'=>_('Youtube Url'), )); $wp_customize->add_control('sp_social_youtube',array( 'label'=>'Youtube Url', 'section'=>__('sp_social_url'), 'priority'=>1, )); $wp_customize->add_setting('sp_social_linkedin',array( 'default'=>_('Linkdin Url'), )); $wp_customize->add_control('sp_social_linkedin',array( 'label'=>'Linkedin Url', 'section'=>__('sp_social_url'), 'priority'=>1, )); } add_action('customize_register','theme_customize_function');
Now if you want show it in footer, just copy the code below and paste in footer.php.
<a target="_blank" class="soc_facebook" href="<?php echo get_theme_mod('sp_social_facebook');?>" rel="nofollow">Facebook</a> <a target="_blank" class="soc_youtube" href="<?php echo get_theme_mod('sp_social_youtube');?>" rel="nofollow">YouTube</a> <a target="_blank" class="soc_linkedin" href="<?php echo get_theme_mod('sp_social_linkedin');?>" rel="nofollow">Linkedin</a>