Add Page Template from Plugin

/**
 * Add page templates.
 *
 * @param array $templates The list of page templates
 *
 * @return array  $templates  The modified list of page templates
 */
function sf_add_page_template_to_dropdown( $templates ) {
	$templates[ plugin_dir_path( __FILE__ ) . 'templates/page-template.php' ] = __( 'Page Template From Plugin', 'text-domain' );
	
	return $templates;
}

add_filter( 'theme_page_templates', 'pt_add_page_template_to_dropdown' );

Leave a Reply