I have been building a tabbed option page based on some tutorials I found, using the settings API. Here is the code http://pastebin.com/bbSnhFP5 . It's all actually working fine for me but it's not ideal and I'm sure there's a better way around it.
The problem is that when I used this tutorial as a base and adapted it to use add_settings_section()
and add_settings_field()
calls, I ended up with code which used register_setting()
(as opposed to perhaps add_theme_page()
) to make the distinction between the tabs ( this is the way the tutorial did it ). This meant that I had to use do_settings_fields()
to print the fields instead of do_settings_sections()
because do_settings_sections()
prints out the entire page of options (as defined by add_theme_page()
) on every tab.
The end result of this is that while I need to have the add_settings_section()
calls ( because I'm using do_settings_section()
) and therefore I need to have callbacks for them, the callbacks cant actually be made to do anything because as far as I know the only way to print out these callbacks is to use do_settings_sections()
which I cant use, so it seems like I'm missing something.
As a sort of hack I have used a switch statement to allow me to put some text at the start of each page but I feel there must be a better way of doing this and some way of allowing multiple sections per tab.
Can anyone add anything?
code mark-up
for code and not bold.