
While last week we went over how to add an options page to the WordPress Administrative navigation, this week we’ll be going over the actual page itself. We’ll talk about how to update options in the database, and how to mimic the design of WordPress’ default pages.
WordPress includes the ability to manage the processing of your options page’s form. Basically it will sanitize the submitted data and update it in the database. It is fairly easy to setup, and is recommend that you use it (whenever possible) instead of your own.
Making your options page look like the WordPress default is just a matter of using the appropriate markup and CSS classes. The markup consists of a div, header tag, form and table. So, let’s get started.
This markup would go in that function we talked about last week. Since we’ll be outputting a lot of non-PHP code to the browser, I’d recommend ending the PHP block (?>) instead of echoing all this out.
We start by opening a div, adding a header tag and beginning our form:
[code='xml']
Plugin Name
[/code]
There you have it, an options page that matches WordPress’ style and doesn’t require you to write the processing stuff yourself.





clickktdotcom
March 19, 2009 6:08 am
Very interesting and usefull post. I looking forward to reading more tips at here.
Thanks!