Now imagine that you want to add a custom template from external source, not from that specific directory, then you can do that easily with this filter hook.
// Add New template from other directory
function add_custom_template( $templates ){
$templates[ 'custom-template' ] = array(
'label' => __( 'Custom Template', 'text-domain' ),
'thumb' => 'URL of the thumbnail source',
'stylesheet' => 'Stylesheet of the template',
'template' => 'Directory of the template file',
);
return $templates;
}
add_filter( 'wooin_invoice_templates', 'add_custom_template' );
Please see the dummy addon here
