Creating a custom page & output on a Plugin

You can use the “page_template” filter to load a custom template for a given page. It will replace the template used whenever the “page” template is called.

Remember to add the template file somewhere on your plugin folder.

add_filter( 'page_template', 'custom_template_function' );
function custom_template_function( $page_template )
{
    if ( is_page( 'my-custom-page-slug' ) ) {
        $page_template = dirname( __FILE__ ) . '/custom-template.php';
    }
    return $page_template;
}