Automattic\WooCommerce\EmailEditor\Engine
Email_Editor::load_email_preview_template
Use a custom page template for the email editor frontend rendering.
Метод класса: Email_Editor{}
Хуков нет.
Возвращает
string.
Использование
$Email_Editor = new Email_Editor(); $Email_Editor->load_email_preview_template( $template );
- $template(строка) (обязательный)
- post template.
Код Email_Editor::load_email_preview_template() Email Editor::load email preview template WC 11.3.0
public function load_email_preview_template( $template ) {
$post = $this->get_current_post();
if ( ! $post instanceof \WP_Post ) {
return $template;
}
if ( ! self::is_email_post_type( $post->post_type ) ) {
return $template;
}
// Anyone can see a published email. For other statuses the user must be able to read the post.
if ( ! is_post_publicly_viewable( $post ) && ! current_user_can( 'read_post', $post->ID ) ) {
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';
}