# Getting template_include to work when allow_url_include is off?

I'm working on a plugin that creates a custom post type and I would like to display a custom template without modifying the theme.

Here's the simplified code I'm working with:

add_filter('template_include', 'my_custom_template');

function my_custom_template($incFile) { global$wp;
global $wp_query; if ($wp->query_vars['post_type'] == 'custom-post-type') {

$incFile = MY_PLUGIN_TEMPLATES . '/template.php'; } return$incFile;

}


The problem I'm running into is that when allow_url_include is turned off in a server's php.ini file, this throws a fun little error:

Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in http://path\to\wp-includes\template-loader.php on line 43

So I guess the question is, is there a way to send a template through the template_include filter without triggering this allow_url_include error?

Thanks!

-
Wouldn't ya know - 10 minutes or less since I asked my question and I've discovered the answer. I was attempting to define MY_PLUGIN_TEMPLATES using plugins_dir_url(), now it looks like this: define( 'MY_PLUGIN_TEMPLATES', WP_PLUGIN_DIR . '/my_plugin/templates' ); And all is well. –  bybloggers Jun 22 '11 at 23:21
I always set the plugin path using the following code: dirname( __FILE__ ) - It will allow the name of the plugin directory to be changed without modifying the code. –  mfields Jun 23 '11 at 1:50
Thanks, just updated it using that. –  bybloggers Jun 23 '11 at 23:58

define( 'MY_PLUGIN_TEMPLATES', dirname( __FILE__ ) . '/templates' );