I have a plugin that creates a few custom post types and I would like the plugin to use a custom template part for displaying single and archive pages for these post types. I would like the template part to display in whatever theme is set on the site in the area the content would normally go. I know bbPress does this somehow using the template_include filter, but when I tried using that with a dummy template, the template replaced the whole page instead of just the content part. Here is some of the code I'm using:
add_filter('template_include', 'veda_template_include');
function veda_template_include($template) {
if(get_query_var('post_type') == 'veda_content' && is_single()) {
$template = VEDA_DIR . 'templates/content-single.php';
}
return $template;
}
And the template itself is just a dummy php file with some output:
<?php
echo 'win';
How would I go about doing this?