[theme-reviewers] Common Things Overlooked in Theme Reviews

Otto otto at ottodestruct.com
Fri Sep 6 19:58:48 UTC 2013


Whether it is in a variable or not, prefixing it instead of using something
like "$args" is really unarguable. Clarity, no mucking with potential
globals, etc.

However, I personally prefer this style:

wp_function_call( array (
  'key1' => 'value1',
  'key2' => 'value2',
  'key3' => 'value3',
) );

It keeps the arguments orderly and close to the function call in which
they're being used. You could put the array in a variable and then pass in
the variable, but this only makes sense when the array is complex or needs
to be built up from pieces. Even then, usually those pieces are simple
other variables in your function, so your call becomes this:

wp_function_call( array (
  'key1' => $value,
  'key2' => $whatever,
  'key3' => $some_other_thing,
) );

It's just a cleaner look, I feel. But either way works.

-Otto



On Fri, Sep 6, 2013 at 2:36 PM, Doug Stewart <zamoose at gmail.com> wrote:

> In re: point #4: why? Adding the arrays in-line can contribute to greater
> illegibility, particularly when the number of array elements grows large.
>
> Color me old-fashioned, but doing it that way strikes me as a hard
> requirement with little actual utility.
>
>
> On Wed, Sep 4, 2013 at 10:28 PM, Emil Uzelac <emil at uzelac.me> wrote:
>
>> Nice! Please see my comment: https://gist.github.com/GaryJones/1698719we need small change :)
>>
>>
>> On Wed, Sep 4, 2013 at 9:26 PM, Dane Morgan <dane at danemorganmedia.com>wrote:
>>
>>> I'm sorry, I had meant to ask if that could be done with scripts as
>>> well. I initially found it in a reference that implied that you could do
>>> the same thing to enqueued scripts, but I never chased it down to see how.
>>>
>>>   Emil Uzelac <emil at uzelac.me>
>>>  Wednesday, September 04, 2013 20:58
>>>
>>> http://lists.wordpress.org/pipermail/theme-reviewers/2013-June/013545.html
>>>
>>>
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>   Dane Morgan <dane at danemorganmedia.com>
>>>  Wednesday, September 04, 2013 20:12
>>>  I was wondering the same thing
>>>
>>>    Josh Pollock <jpollock412 at gmail.com>
>>>  Wednesday, September 04, 2013 19:17
>>> Why are the IE compatibility scripts hardcoded instead of echoed in a
>>> function hooked to wp_head? I'm wondering both in terms of why hardcoding
>>> is standard practice and why hooking to wp_head isn't required.
>>>
>>>
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>   Chip Bennett <chip at chipbennett.net>
>>>  Wednesday, September 04, 2013 18:53
>>> There's not much that can be done right now, until this ticket makes it
>>> into core:
>>> http://core.trac.wordpress.org/ticket/16024
>>>
>>> In the meantime, those scripts can optionally be hard-coded in the
>>> document head (though they could be recommended to be added via callback
>>> hooked into wp_head).
>>>
>>>
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>   Ulrich Pogson <grapplerulrich at gmail.com>
>>>  Wednesday, September 04, 2013 18:35
>>>
>>> @chip what is your recommendation for including IE specific scripts in
>>> the header? I am talking about the second point you mentioned.
>>> _______________________________________________
>>> 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
>>
>>
>
>
> --
> -Doug
>
>
>
> _______________________________________________
> 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/20130906/901c08ed/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1258 bytes
Desc: not available
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20130906/901c08ed/attachment-0005.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1220 bytes
Desc: not available
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20130906/901c08ed/attachment-0006.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1409 bytes
Desc: not available
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20130906/901c08ed/attachment-0007.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1291 bytes
Desc: not available
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20130906/901c08ed/attachment-0008.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1200 bytes
Desc: not available
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20130906/901c08ed/attachment-0009.jpg>


More information about the theme-reviewers mailing list