Automattic\WooCommerce\EmailEditor\Engine
Email_Editor::load_email_preview_template
Use a custom page template for the email editor frontend rendering.
Method of the class: Email_Editor{}
No Hooks.
Returns
String.
Usage
$Email_Editor = new Email_Editor(); $Email_Editor->load_email_preview_template( $template );
- $template(string) (required)
- post template.
Email_Editor::load_email_preview_template() Email Editor::load email preview template code WC 10.5.0
public function load_email_preview_template( $template ) {
$post = $this->get_current_post();
if ( ! $post instanceof \WP_Post ) {
return $template;
}
if ( ! $this->current_post_is_email_post_type( $post->post_type ) ) {
return $template;
}
add_filter(
'woocommerce_email_editor_preview_post_template_html',
function () use ( $post ) {
// Generate HTML content for email editor post.
return $this->send_preview_email->render_html( $post );
}
);
return __DIR__ . '/Templates/single-email-post-template.php';
}