Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduced the %subject% as an available tag on the Email Template #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions wpbe.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,15 @@ function ajax_send_preview( $email ) {
*/
function template_vars_replacement( $template ) {

global $phpmailer;

$to_replace = array(
'blog_url' => get_option( 'siteurl' ),
'home_url' => get_option( 'home' ),
'blog_name' => get_option( 'blogname' ),
'blog_description' => get_option( 'blogdescription' ),
'admin_email' => get_option( 'admin_email' ),
'subject' => $phpmailer->Subject,
'date' => date_i18n( get_option( 'date_format' ) ),
'time' => date_i18n( get_option( 'time_format' ) )
);
Expand Down Expand Up @@ -391,7 +394,7 @@ function check_template() {
/**
* Add the template to the message body.
*
* Looks for %message% into the template and replaces it with the message.
* Looks for %subject% and %content% in the template and replaces them appropriately.
*
* @since 0.1
* @param string $body The message to templatize
Expand Down Expand Up @@ -584,8 +587,9 @@ function contextual_help( $contextual_help, $screen_id, $screen ) {
return $contextual_help;
}

return '<p>' . __( 'Some dynamic tags can be included in your email template :', 'wp-better-emails' ) . '</p>
$help_content = '<p>' . __( 'Some dynamic tags can be included in your email template :', 'wp-better-emails' ) . '</p>
<ul>
<li>' . __( '<strong>%subject%</strong> : will be replaced with the emails Subject.', 'wp-better-emails' ) . '</li>
<li>' . __( '<strong>%content%</strong> : will be replaced with the message content.', 'wp-better-emails' ) . '<br />
<span class="description"> ' . __( 'NOTE: The content tag is <strong>required</strong>, WP Better Emails will be automatically desactivated if no content tag is found.', 'wp-better-emails' ) . '</span></li>
<li>' . __( '<strong>%blog_url%</strong> : will be replaced with your blog URL.', 'wp-better-emails' ) . '</li>
Expand All @@ -596,6 +600,15 @@ function contextual_help( $contextual_help, $screen_id, $screen ) {
<li>' . __( '<strong>%date%</strong> : will be replaced with current date, as formatted in <a href="options-general.php">general options</a>.', 'wp-better-emails' ) . '</li>
<li>' . __( '<strong>%time%</strong> : will be replaced with current time, as formatted in <a href="options-general.php">general options</a>.', 'wp-better-emails' ) . '</li>
</ul>';

$screen->add_help_tab( array(
'id' => 'help-wp-better-emails',
'title' => 'Template Tags',
'content' => $help_content,
));

return $contextual_help;

}

/**
Expand Down