Skip to content

Instantly share code, notes, and snippets.

@tmosest
Last active February 13, 2017 22:13
Show Gist options
  • Save tmosest/a38dd5bc7edc85375fd0cf38d975dcff to your computer and use it in GitHub Desktop.
Save tmosest/a38dd5bc7edc85375fd0cf38d975dcff to your computer and use it in GitHub Desktop.
Wordpress Social Media Theme Options
<?php
/**
* Add Custom theme options
*/
class tmosestBlog_Customize {
public static function register ( $wp_customize ) {
tmosestBlog_Customize::addSocialLinks($wp_customize);
tmosestBlog_Customize::addCopyRightText($wp_customize);
}
public static function addCopyRightText( $wp_customize ) {
// adding section in wordpress customizer
$wp_customize->add_section('copyright_extras_section', array(
'title' => 'Copyright Text Section'
));
// adding setting for copyright text
$wp_customize->add_setting('text_setting', array(
'default' => 'Default Text For copyright Section',
));
// adding control for copyright text
$wp_customize->add_control('text_setting', array(
'label' => 'Copyright text',
'section' => 'copyright_extras_section',
'type' => 'text',
));
}
public static function addSocialLinks( $wp_customize ) {
// adding section in wordpress customizer
$wp_customize->add_section('socialmedia_extras_section', array(
'title' => 'Social Media Section'
));
// adding setting for twitter text url
$wp_customize->add_setting('twitter_setting', array(
'default' => 'https://www.twitter.com/',
));
// adding control for twitter text url
$wp_customize->add_control('twitter_setting', array(
'label' => 'Twitter URL',
'section' => 'socialmedia_extras_section',
'type' => 'text',
));
// adding setting for linkined text url
$wp_customize->add_setting('linkined_setting', array(
'default' => 'https://www.linkedin.com/',
));
// adding control for linkined text url
$wp_customize->add_control('linkined_setting', array(
'label' => 'Linkedin URL',
'section' => 'socialmedia_extras_section',
'type' => 'text',
));
// adding setting for rss feed text url
$wp_customize->add_setting('rss_setting', array(
'default' => site_url().'/feed',
));
// adding control for rss feed text url
$wp_customize->add_control('rss_setting', array(
'label' => 'RSS feed URL',
'section' => 'socialmedia_extras_section',
'type' => 'text',
));
// adding setting for google plus text url
$wp_customize->add_setting('googleplus_setting', array(
'default' => 'https://plus.google.com/',
));
// adding control for google plus text url
$wp_customize->add_control('googleplus_setting', array(
'label' => 'Google + URL',
'section' => 'socialmedia_extras_section',
'type' => 'text',
));
// adding setting for facebook text url
$wp_customize->add_setting('facebook_setting', array(
'default' => 'https://www.facebook.com/',
));
// adding control for facebook text url
$wp_customize->add_control('facebook_setting', array(
'label' => 'Facebook URL',
'section' => 'socialmedia_extras_section',
'type' => 'text',
));
// adding setting for Youtube text url
$wp_customize->add_setting('youtube_setting', array(
'default' => 'https://www.facebook.com/',
));
// adding control for Youtube text url
$wp_customize->add_control('youtube_setting', array(
'label' => 'Youtube URL',
'section' => 'socialmedia_extras_section',
'type' => 'text',
));
// adding setting for Github text url
$wp_customize->add_setting('github_setting', array(
'default' => 'https://www.github.com/',
));
// adding control for Github text url
$wp_customize->add_control('github_setting', array(
'label' => 'Github URL',
'section' => 'socialmedia_extras_section',
'type' => 'text',
));
}
}
add_action( 'customize_register' , array( 'tmosestBlog_Customize' , 'register' ) );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment