Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Newbie in wordpress coding. please tell how to create theme option pages.

function my_plugin_menu() {

    add_theme_page('Theme Options', 'Theme Options', 'edit_theme_options', 'theme-option-slug' , 'settings_page'); 
}

function settings_page()
{
    echo "aa";  
}
share|improve this question
    
The Codex is your friend: codex.wordpress.org/Function_Reference/add_theme_page –  brasofilo Feb 26 '13 at 11:12
add comment

1 Answer

up vote 0 down vote accepted

You created the callback function and the function for adding the Theme page, but you also have to tell WordPress when to call your function my_plugin_menu. You can do this by hooking into admin_menu.

add_action('admin_menu', 'my_plugin_menu');

This way WordPress knows that when it reaches the Scripts for admin_menu, it also has to execute your code, thus adding your Theme Page.

More information on this is available on the Codex.

share|improve this answer
    
sorry i forgot to mention add_action('admin_menu', 'my_plugin_menu'); but still no result –  Alizain Prasla Feb 26 '13 at 11:23
    
Did you check the capabilities for the user where you are testing this? –  fischi Feb 26 '13 at 11:25
    
i am super admin –  Alizain Prasla Feb 26 '13 at 11:29
    
The Code you wrote above works perfectly fine. You may be Super Admin, but you can still lack the capability of edit_theme_options, those are two different things. Ehat happens when you load the page yourdomain.com/wp-admin/themes.php?page=theme-option-slug ? –  fischi Feb 26 '13 at 11:34
    
Nice. So it was maybe just a caching problem :) –  fischi Feb 26 '13 at 12:02
show 5 more comments

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.