Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.