[wp-hackers] Widget Weirdness - Doesn't like the file name widgets.php

Chip Bennett chip at chipbennett.net
Tue Jun 28 13:51:28 UTC 2011


Using get_stylesheet_directory() would also work for non-template-part files
intended to be over-ridden by Child Themes. Though, for something like
Widgets code (that isn't likely to be over-ridden), I would use
get_template_directory(), and if the Child Theme wants to override specific
Widgets, it can unregister_widget()/register_widget().

Chip

On Tue, Jun 28, 2011 at 4:47 AM, John Blackbourn
<johnbillion+wp at gmail.com>wrote:

> On 28 June 2011 10:06, Alex Andrews <awgandrews at gmail.com> wrote:
> > Thanks for all this folks, learnt my lesson and may also submit a
> > patch to the Roots theme on this account.
>
> Another neat way to load files from within a theme is to use
> WordPress' get_template_part( 'includes/widgets') instead of a regular
> include() or require(). This allows a child theme to override these
> files in the same way core template files are overridden if they're
> present. Might be worth suggesting to the theme author.
>
> John
> _______________________________________________
> 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