-
-
Save danielbitzer/ce1aba7e19dae2d01583f9058e74264c to your computer and use it in GitHub Desktop.
<?php | |
add_filter( 'automatewoo_email_templates', 'my_automatewoo_email_templates' ); | |
function my_automatewoo_email_templates( $templates ) { | |
// SIMPLE | |
// register a template by adding a slug and name to the $templates array | |
$templates['custom-1'] = 'Custom Template #1'; | |
// ADVANCED | |
// you can also create a template with a unique from name and from email by passing using the following array format | |
$templates['custom-2'] = array( | |
'template_name' => 'Custom Template #2', | |
'from_name' => 'AutomateWoo Custom', | |
'from_email' => 'custom@automatewoo.com' | |
); | |
// SETTING A CUSTOM PATH | |
// As of version 4.8, it's possible to set a custom template path | |
$templates['custom-3'] = array( | |
'template_name' => __( 'Custom Template with a custom path', 'my-plugin' ), | |
'path' => dirname( __FILE__ ) . '/templates/custom-1' | |
); | |
return $templates; | |
} |
thought I was the only one seeing this issue? been racking my brains ever since.
I spotted an error from line 21: 'custom-3' which is not similar to what should be found in line 23: 'custom-1'
also if all templates are php files, why is line 23 custom-1 and not custom-1.php?
is it advisable to remove the dirname method and just write the full path into the '' marks?
Help please! I've created the custom template but I am stuck with the actual linking part. My file is inside my child theme like so: automatewoo/emails/aw-inkopialoves.php and my this is my code:
`$templates['aw-inkopialoves'] = array('template_name' => __( 'AutomateWoo inkopialoves Template', 'aw-inkopialoves' ), 'from_name' => 'inkopia', 'from_email' => 'order@inkopia.com', 'path' => dirname( __FILE__ ) . '/automatewoo/email/' );`
The code is not picking up my template file 'aw-inkopialoves.php' and I have no clue how to link it properly past this. Only file it picks up inside automatewoo/email/ is email-header.php.
if anyone can help, I woud be super grateful! 🤓
any luck solving it @charlotteoswald?
Looking at the AutomateWoo plugin code, I cannot see how any data except the template name is being utilised when the filter is applied:
$templates = apply_filters( 'automatewoo_email_templates', self::$templates );
Appears the $template_data['path']
is stripped out, only $template_data['template_name']
is used...
Help please! I've created the custom template but I am stuck with the actual linking part. My file is inside my child theme like so: automatewoo/emails/aw-inkopialoves.php and my this is my code:
`$templates['aw-inkopialoves'] = array(
The code is not picking up my template file 'aw-inkopialoves.php' and I have no clue how to link it properly past this. Only file it picks up inside automatewoo/email/ is email-header.php.
if anyone can help, I woud be super grateful! 🤓