1. Go to this page and download the library: Download stellarwp/templates library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Boomshakalaka\StellarWP\Templates\Template;
class My_Custom_Template extends Template {
/**
* Defines the base path for the templates.
*
* @since 1.0.0
*/
protected array $template_base_path = [ PATH_TO_YOUR_PROJECT_ROOT ];
}
$template = new My_Custom_Template();
// Set the folder within your plugin where templates are stored.
$template->set_template_folder( 'src/views/products' );
// Should users be able to override templates in their theme?
$template->set_template_folder_lookup( true );