[theme-reviewers] wrapping functions with if( ! function_exists() ) {…}

Ulrich Pogson grapplerulrich at gmail.com
Sat Oct 11 15:58:22 UTC 2014


This is the section on child theme support.
https://make.wordpress.org/themes/handbook/guidelines/including-stylesheets-scripts/#child-theme-support

On 11 October 2014 17:48, Srikanth Koneru <tskk79 at gmail.com> wrote:

> First part is only recommended because themes are only required to be
> child friendly to extent that importing parent theme's stylesheet in child
> theme's stylesheet should work.
>
> Second part is actually somewhere in the guidelines as required.
>
> On Sat, Oct 11, 2014 at 8:49 PM, Bego Mario Garde <pixolin at yahoo.com>
> wrote:
>
>> Hello,
>>
>> I have another question, this time regarding the usage of
>>
>>   if( !function_exists()) {…}
>>
>> for non-core theme-functions.
>>
>> Otto (Samuel Wood) explained very well on
>>
>> http://wordpress.stackexchange.com/questions/111299/why-use-if-function-exists
>>
>> "The if function_exists approach allows for a child theme to override
>> the function definition by simply defining the function themselves.
>> Since child theme's functions.php files load first, then they will
>> define the function first and the parent's definition will not get
>> loaded."
>>
>> Chip Bennet defined on
>>
>> http://www.chipbennett.net/2011/04/20/a-guide-to-reviewing-themes-for-the-wordpress-theme-repository/
>>
>>
>> "No core WordPress functions introduced prior to one previous, major
>> WordPress release are wrapped in function_exists() conditionals."
>>
>> Yet I miss this being mentioned in the theme review guidelines nor do I
>> know whether wrapping functions is only *recommended* or even *required*.
>>
>> Could someone please explain how I should deal with it?
>>
>> Thank you, Bego (@pixolin)
>> _______________________________________________
>> 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/20141011/f6de9039/attachment.html>


More information about the theme-reviewers mailing list