Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Coldfight

    (@coldfight)

    I figured it out! For anyone who has the same problem, here is the fix:

    add_filter( "single_template", "get_custom_post_type_template" ) ;
    
    function get_custom_post_type_template($single_template) {
         global $post;
    
         if ($post->post_type == 'custom-post-type') {
              $single_template = dirname( __FILE__ ) . '/single-custom-post-type.php';
         }
         return $single_template;
    }

    I hope that helps other people!

    Anybody with an answer?

    I have that exact same question. The way I’m doing it right now, though (not sure if it’s correct), is:

    function foo() {
        bar();
        flush_rewrite_rules();
    }
    register_activation_hook( __FILE__, 'foo' );
    
    add_action('init', 'bar');
    function bar() {
        //...
        register_post_type( 'other' , $args );
        //register_taxonomy(...);
    }
Viewing 2 replies - 1 through 2 (of 2 total)