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

Alex Andrews awgandrews at gmail.com
Mon Jun 27 14:51:01 UTC 2011


Interesting - why then are all the other includes working fine? I was
copying the practice I'd seen on the Roots plugin, so assumed it was
fine.

Thanks a lot.

Alex

On 27 June 2011 15:46, John Blackbourn <johnbillion+wp at gmail.com> wrote:
> On 27 June 2011 15:45, John Blackbourn <johnbillion+wp at gmail.com> wrote:
>> On 27 June 2011 14:13, Alex Andrews <awgandrews at gmail.com> wrote:
>>> Hey folks,
>>>
>>> Getting something odd going on with Widgets. In the context of a
>>> theme, I am attempting to add customised widgets. For ease of coding,
>>> widgets live in another file includes/widgets.php.
>>>
>>> If I do, in the functions.php file:
>>>
>>> require_once('includes/widgets.php');
>>>
>>> function buffer_widgets_init () {
>>>    register_widget('buffer_latest_features_widget');
>>> }
>>> add_action('widgets_init', 'buffer_widgets_init');
>>>
>>> Then it fails with a message: Fatal error: Class
>>> 'buffer_latest_features_widget' not found in
>>> /Users/alex/Sites/wp-includes/widgets.php on line 324.
>>
>> Your include() line is trying to include the widgets.php file inside
>> wp-admin/includes. You should either use a full path in your
>> include(), or rename the file.
>>
>
> Sorry, I meant your require_once() line, not include().
> _______________________________________________
> 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