[wp-hackers] Enhancements to Settings API
Chip Bennett
chip at chipbennett.net
Sat Oct 22 16:24:08 UTC 2011
Creating tabbed Theme settings pages, using the Settings API? Funny you
should mention that. :)
http://www.chipbennett.net/2011/02/17/incorporating-the-settings-api-in-wordpress-themes/
I've actually polished up the approach considerably since then, including
dynamic output of the form-field markup, dynamic calls to
add_settings_section() and add_settings_field(), and dynamic validation
based on data type. See Oenology for example code:
https://github.com/chipbennett/oenology/blob/master/functions/options-register.php
(Note that, I even include an example of a Theme setting ("varietals", or
"skins") that requires custom markup/validation.)
Chip
On Sat, Oct 22, 2011 at 10:42 AM, Ade Walker <photofantaisie at gmail.com>wrote:
> Chip,
>
> 2011/10/21 Chip Bennett <chip at chipbennett.net>
>
> > First, I would recommend following/contributing to Trac Ticket
> > #18285<http://core.trac.wordpress.org/ticket/18285>for Settings
> > API-related changes.
> >
>
> Thanks for the link - very useful.
>
>
> > Second, IMHO, settings that use markup other than that ascribed by core
> are
> > Doing It Wrong. Reasonable minds will disagree,
>
>
> Yes, I disagree. :-)
>
>
> > but I believe that
> > Themes/Plugins should be emulating core UI as much as possible.
>
>
> I agree with that, but I don't think the API should preclude allowing
> deviations altogether. I think it comes down to extensibility - keeping
> default behaviour which 100% fits in to the WP way, but allowing
> customisation when required. In the particular use case I'm working with,
> which requires tabs in order to make a reasonable user experience for the
> settings page, I am effectively blocked from using the full Settings API -
> which I think is a shame. (Having said that, I need to think through the
> suggestion in Otto's reply.)
>
> Anyway, I'll check that ticket and see which way the wind is blowing on
> this
> subject.
>
> Cheers.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list