Take the 2-minute tour ×

Hi I am trying to learn to add theme options to WordPress themes by reading The Complete guide to WordPress Settings Api on wptuts I have gotten as far as the 4th part and have stoped to create an example for myself because I have gotten confused with how can I add the sections I create in a page.Here is my code:

 function thanatos_theme_menu(){
                   "Thanathos Theme Options", 
                   "Thanathos Theme", 
add_action('admin_menu' , 'thanatos_theme_menu');
function thanathos_theme_display_callback(){
      echo "Johny la hanta este mui loca"; 

add_action('admin_init' , 'thanatos_initializa_theme_options');
function thanatos_initializa_theme_options(){
            'Thanatos Options', 
            'thanathos_theme_options' //I believe this where my mistakes is 

function thanatos_general_options_callback(){
    echo 'mergem la mare';

I have used the page id in order to set where to put this section and I belive the thanatos_general_options_callback() should display there but for some reasons it doesn't.What am I doing wrong here?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I think you may need to use the functions settings_fields do_settings_sections and register_setting as well as add_setting_section to get this working see refs. to these functions here. I'm not sure if you could get a bare bones version working leaving some of those out but maybe or maybe not ... there are a lot of functions used in a working options page I know.

I would advise copying a finshed working options page such as Jeffrey way's offering into your theme and removing stuff till you get to a bare bones working model. It will help you to understand this as it's pretty complex.

It's also complex enough to warrant setting up multiple practice themes on your system so you can experiment with different versions/stages of an options page if it's your first venture into it.

Also in research be aware of the "Old way" and "New way" of doing settings. Settings API is the "New way"

Edit - as Eric Said, having "administrator" as capability is suspect.

share|improve this answer
Also, please see my tutorial: Incorporating the Settings API in WordPress Themes. I get into a bit more detail about the inter-relationship of all of the Settings API functions. –  Chip Bennett Aug 21 '12 at 15:26

You have one main in your add_theme_page() call.

Please use the codex as reference.

Where you have "administrator" you are giving the function a role, as opposed to a capability. Use "install_themes" instead.

The probable situation is that when you are logged in you do not have the 'administrator' capability (as it does not exist) so the page is not displaying for you.

share|improve this answer
Actually, the correct capability is 'edit_theme_options'. –  Chip Bennett Aug 21 '12 at 15:24

Your Answer


