[theme-reviewers] Stupid Question of the Day

Chip Bennett chip at chipbennett.net
Wed Aug 24 18:51:26 UTC 2011

For including functional (as opposed to template) files in a Theme, you
should use something like the following in functions.php:

include_once( get_template_directory() . '/relative/path/to/file.php' );

Unless the file is intended to be over-ridden in a Child Theme, in which
case you would use:

include_once( get_stylesheet_directory() . '/relative/path/to/file.php' );

I'm sure Plugins would be similar, but that's a question outside the scope
of Theme-Reviewers. :)


On Wed, Aug 24, 2011 at 1:39 PM, Ryan Frankel <ryan.frankel at gmail.com>wrote:

> All,
>  I have a dumb question that I am sure has been covered a million times but
> I am not sure what the best way to include PHP files into my plugin/theme.
> What I currently have is something like below which can't possibly be the
> right way to do it.
>                        include_once(WP_PLUGIN_DIR .
> '/swamped-event-calendar/php/functions_db.php');
>                        include_once(WP_PLUGIN_DIR .
> '/swamped-event-calendar/php/functions_calendar.php');
>                        include_once(WP_PLUGIN_DIR .
> '/swamped-event-calendar/php/functions_list.php');
> Any tips on this would be greatly appreciated.
> Ryan
> _______________________________________________
> 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/20110824/25d67dd2/attachment.htm>

More information about the theme-reviewers mailing list