This plugin is intended to be useful more for developers than other types of users.
与其他类型的用户相比,该插件旨在对开发人员更有用。 p>
Have you ever had a client who likes to be able to independently update the content of the emails that your code is sending out programmatically?
您是否曾经有一个客户希望能够独立更新您的代码以编程方式发送的电子邮件的内容?
If so, this plugin might help you make your client happy.
如果是这样,此插件可能会帮助您使客户满意。 p>
How to use:
使用方法: p>
When you activate the plugin, it adds a custom post type to your website called “Email Templates”.
激活插件后,它将在您的网站上添加一个自定义帖子类型,称为“电子邮件模板”。
You can create your templates using this custom post type.
您可以使用此自定义帖子类型创建模板。
Templates can contain placeholders for your code to fill them up with desired values.
模板可以包含占位符,以供您的代码填充所需的值。
A placeholder sample would be {USERNAME} or {USER_EMAIL}.
占位符示例为{USERNAME}或{USER_EMAIL}。
Please note, placeholders should not contain lowercase letters.
请注意,占位符不应包含小写字母。 p>
This plugin creates a global instance of the BlueCube\Email_Template class which is called $bluecube_email_template.
此插件创建BlueCube \ Email_Template类的全局实例,该实例称为$ bluecube_email_template。
Once you have created a template, you can use the sendEmail() method of the instance to send out your emails.
创建模板后,可以使用实例的sendEmail()方法发送电子邮件。 p>
$email_args = array( $ email_args = array( 'template_title' => 'your-template-title',
'template_title'=>'您的模板标题',
'to' => $email,
'至'=> $ email,
'variables' => array('username' => 'JohnDoe', 'user_email' => 'test@test.com'),
'变量'=>数组('用户名'=>'约翰杜德','用户电子邮件'=>'test@test.com'),
);
);
$bluecube_email_template->sendEmail($email_args);
$ bluecube_email_template-> sendEmail($ email_args);
code> pre>