[theme-reviewers] Function submit_button()

George Mamadashvili georgemamadashvili at gmail.com
Mon Jul 25 17:06:37 UTC 2011


Thanks, few minutes ago I checked you Oenology theme on github and found
those changes.

On Mon, Jul 25, 2011 at 8:58 PM, Chip Bennett <chip at chipbennett.net> wrote:

> The submit_button() function is flexible enough to handle resetting to
> defaults. :)
>
> For example, here's my old code from Oenology (note that I pass a "tab"
> name to the button name attribute):
>
> <input name="theme_oenology_options[submit-<?php echo $tab; ?>]"
> type="submit" class="button-primary" value="Save Settings" />
> <input name="theme_oenology_options[reset-<?php echo $tab; ?>]"
> type="submit" class="button-secondary" value="Reset Defaults" />
>
>
> And here's the replacement code:
>
> <?php submit_button( __( 'Save Settings', 'oenology' ), 'primary',
> 'theme_oenology_options[submit-' . $tab . ']', false ); ?>
> <?php submit_button( __( 'Reset Defaults', 'oenology' ), 'secondary',
> 'theme_oenology_options[reset-' . $tab . ']', false ); ?>
>
>
> The rendered output is exactly the same in both cases.
>
> Assuming that your "reset defaults" functionality looks at the NAME
> attribute as part of the $_POST data passed to $input, then you're good to
> go.
>
> Chip
>
>
> On Mon, Jul 25, 2011 at 11:44 AM, George Mamadashvili <
> georgemamadashvili at gmail.com> wrote:
>
>> Hello Chip.
>>
>> I noticed that function too and liked it, but if theme author what to
>> provide "Reset to Default" button, does it still need to be hard-coded? I
>> had no to dig in this function, can we this function for reset button too?
>>
>> Best
>>
>> George
>>
>> On Mon, Jul 25, 2011 at 8:25 PM, Chip Bennett <chip at chipbennett.net>wrote:
>>
>>> Good morning developers/reviewers!
>>>
>>> Just a note, from something that I noticed being used in Twenty Eleven:
>>> the submit_button()<http://codex.wordpress.org/Function_Reference/submit_button>function, which replaces hard-coded form submit buttons.
>>>
>>> I would strongly recommend making use of it in Theme Settings Page forms;
>>> as with other "doing things the core-supported way" criteria, I would expect
>>> this one to show up in the Guidelines at some point in the future.
>>>
>>> Chip
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>
>>>
>>
>> _______________________________________________
>> theme-reviewers mailing list
>> theme-reviewers at lists.wordpress.org
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>
>>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110725/e775e0ec/attachment.htm>


More information about the theme-reviewers mailing list