• This is the code I have currently. Am I missing something? The video page would not load if I add /amp to the url.

    add_action( 'amp_init', 'amp_cpt' );
    
    function amp_cpt() {
        add_post_type_support( 'video', AMP_QUERY_VAR );
    }
    
    add_filter( 'amp_post_template_file', 'amp_cpt_template', 10, 3 );
    
    function amp_cpt_template( $file, $type, $post ) {
        if ( 'single' === $type && 'video' === $post->post_type ) {
            $file = dirname( __FILE__ ) . '/templates/amp-cpt-template.php';
        }
        return $file;
    }
    

The topic ‘Custom Post Type issue’ is closed to new replies.