[wp-hackers] Saving Radio Options in Plugin Menu

Otto otto at ottodestruct.com
Sat Nov 23 11:46:46 UTC 2013


On Sat, Nov 23, 2013 at 5:36 AM, Otto <otto at ottodestruct.com> wrote:

> On Sat, Nov 23, 2013 at 5:23 AM, BenderisGreat <greglancaster71 at gmail.com>wrote:
>
>> The whole block is wrong?
>
>
> This is how you would do that correctly. For one, you wouldn't use a
> printf at all:
>
>
But if you *really* wanted to use a printf, you could do it like this:

printf('<input type="radio" name="ams_options[%s]"
value="voteThumbs"%s>voteThumbs</input>', 'ams_choose_comment_buttons',
checked('voteThumbs', $buttonStyle, false ) );

The third "false" parameter to the checked function suppresses the echo'ing
of the result, then the second %s in the right place in the printf will put
the attribute inside the input html. Also, I added the closing </input> in
there too.

-Otto


More information about the wp-hackers mailing list