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

David Law wp-hackers at google-adsense-templates.co.uk
Mon Jun 27 17:15:04 UTC 2011


On Mon, 27 Jun 2011 14:13:06 +0100, you 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');

Hi,

My functions.php contains no functions, just includes to files (about
30) holding the code, but I use:

<?php include (TEMPLATEPATH . "/widgets/general-widgets.php"); ?>

Have thousands of customers using themes with the above format and not
had a single problem.

David
-- 
http://www.stallion-theme.com/ Stallion WordPress SEO Theme
http://www.stallion-theme.com/stallion-wordpress-seo-plugin Stallion
WordPress SEO Plugin


>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. However, if I
>copy and paste the whole code in includes/widgets into the
>functions.php file, lo and behold, it finds the
>buffer_latest_features_widget class.
>
>The same is true if I rename the file as anything but widgets.php and
>move it anywhere - works fine.
>
>Is there any reason for this or am I doing something stupid or wrong?
>What's going on?
>
>Thanks a lot.
>
>Alex
>_______________________________________________
>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