WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is my theme option code link. Why can't I see my fields?. I got this tutorial from WordPress Premium Theme Admin Part 2.

I don't want tab in this theme option, so what are codes here, I need not to mention?

//create custom admin menu's
// add the main menu
 add_action('admin_menu', 'my_theme_menu');
 function my_theme_menu(){

// the settings

$page_title = "My Themes Admin";

$menu_title = "Theme Settings";
* Please not that this changed in the latest wordpress
* versions from a number to words for user capabilities.
* This would of been 7 but now you should use 'administrator'.
$capability = 'administrator';

$menu_slug = "theme-settings";

$function = "main_theme_menu_plugin";

$icon_url = ""; // could be anything jpg, png, gif

$position = '5';

add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); // create the menu


wp_enqueue_script( 'jquery' );  //this code here  enables jquery

// Here we add the jQuery UI script to our theme header

wp_register_script( 'jquery-ui-script', plugins_url('/js/jquery-ui-1.8.16.custom.min.js', __FILE__)); //this part registers the new script

wp_enqueue_script( 'jquery-ui-script' ); //this part puts the script in to our page header

// Here we add the jQuery UI theme Css to our header
$myThemeStyleUrl = plugins_url('/css/ui-lightness/jquery-ui-1.8.16.custom.css', __FILE__); //set the path to our css

wp_enqueue_style('jquery-ui-style', $myThemeStyleUrl,'1.0','screen'); // this puts the css in the header

// Here we add the code that enables the tabbed menu
add_action('admin_head', 'enableTabMenu_plugin');

function enableTabMenu_plugin(){

<script type="text/javascript">

jQuery(function() {

jQuery( '#tabs' ).tabs();





function main_theme_menu_plugin() {

// Social Settings Page
function socialSettings(){

$social = '
<div id="social-settings">' . settings_fields( 'ty-option-group' ) . '
<h2>Social Settings</h2>
<div id="social-wrapper"><form action="" method="post" name="socialform"><label for="facebook">Facebook: </label><input id="facebook" type="text" name="facebook" value="' .  get_option('ty-facebook') . '" /><a href="' . get_option('ty-facebook') .'"><img src="' .get_bloginfo('template_url') .'/images/social/facebook.png" alt="facebook" /></a>

 <label for="twitter">Twitter: </label><input id="twitter" type="text" name="twitter" value="'. get_option('ty-twitter') .'" /><a href="' . get_option('ty-twitter') .'"><img src="'. get_bloginfo('template_url') .'/images/social/twitter.png" alt="twitter" /></a>

 <label for="linkedin">LinkedIn: </label><input id="linkedin" type="text" name="linkedin" value="' . get_option('ty-linkedin') .'" /><a href="' . get_option('ty-linkedin') .'"><img src="'. get_bloginfo('template_url') .'/images/social/linkedin.png" alt="linkedin" /></a>

 <label for="flickr">Flickr: </label><input id="flickr" type="text" name="flickr" value="'. get_option('ty-flickr') .'" /><a href="'. get_option('ty-flickr') .'"><img src="'. get_bloginfo('template_url') .'/images/social/flickr.png" alt="flickr" /></a>

 <label for="skype">Skype: </label><input id="skype" type="text" name="skype" value="'. get_option('ty-skype') .'" /><a href="'. get_option('ty-skype') .'"><img src="'. get_bloginfo('template_url') .'/images/social/skype.png" alt="skype" /></a>

 <input id="social-button" class="button-primary" style="margin-top: 10px;" type="button" value="Save Social" />

return $social;

// Save Social Settings Data
 add_action('wp_ajax_slider_my_action', 'saveSocialSettings'); //ajax callback
function saveSocialSettings() {
    // set default values
    if(get_option('ty-facebook') == ""){

        update_option( 'ty-facebook', 'Facebook URL...');


    if(get_option('ty-twitter') == ""){

        update_option('ty-twitter', 'Twitter URL...');


    if(get_option('ty-linkedin') == ''){

        update_option('ty-linkedin', 'Linkedin URL...');


    if(get_option('ty-flickr') == ''){

        update_option('ty-flickr', 'Flickr URL...');


    if(get_option('ty-skype') == ''){

        update_option('ty-skype', 'Skype URL...');


    // Save data to option fields
    if(! empty($_POST)){

        $facebook = $_POST['ty_facebook'];
        $twitter = $_POST['ty_twitter'];
        $linkedin = $_POST['ty_linkedin'];
        $flickr = $_POST['ty_flickr'];
        $skype = $_POST['ty_skype'];

        // save the form values to the option fields
        update_option( 'ty-facebook', $facebook);
        update_option( 'ty-twitter', $twitter);
        update_option( 'ty-linkedin', $linkedin);
        update_option( 'ty-flickr', $flickr);
        update_option( 'ty-skype', $skype);


share|improve this question
Please include a minimal test case in your question. A question should never rely on an external site. – toscho Jul 11 '13 at 6:43
Iam Sorry toscho, Thank you for your replay.I just edited the question. – Shihab Malayil Jul 11 '13 at 7:09
During an edit, I found many of your tags are not correct, taking the HTML character instead of the opening braces: &lt; instead of <. Can you assure that's a mistake and that's not the cause of your malfunction? – Mayeenul Islam Jul 11 '13 at 18:03
Mayeenul islsam, that's why i gave you the pastebin link. &lt; is the only way i found to paste code here.sorry, please look @ pastebin code and fix please. – Shihab Malayil Jul 11 '13 at 19:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.