Skip to main content Skip to navigation Skip to footer

Email Templates

Updated

Do you need a Developer?

Customising email templates may require custom code which I can’t provide support for. If you need help with customising email templates, including changing text or adding new information, you may need to hire a developer to help you.

You can customise the default alert email template that is used for the emails that are sent immediately that Content Notify sends out via two methods:

  1. Using a template file.
  2. Using a filter.

The plugin checks for the template file first, then applies the filter. As such, it is possible to override the template file and then override it further using a filter, should you wish. You’ll probably only need to use one of the two methods though.

The digest alert template can only be overridden using the template file method, mentioned below.

Using a Template File

To customise the email templates that Content Notify uses for immediate and digest alerts, copy the wp-content/plugins/content-notify/templates folder to wp-content/themes/your-theme/cn-templates, replacing ‘your-theme’ with the folder name of your theme.

You can then customise the email via this new theme file to include additional information, change the colours and layout, and so on.

This file may be updated with new releases of Content Notify so it’s worth periodically checking that your template version matches that of the main plugin.

Using a Filter

If you prefer to use a filter to override the contents of the email, you can use the filter cn\alert\html.

A full example can be found on the Hooks & Filters page.

PHP Variables

When editing the template, there are a few handy PHP variables that you can use:

Variable Name: $subject
Type: string
Description: This is the subject of the email.

Variable Name: $featured
Type: string
Description: The featured image, pre-formatted as an img tag, if one is set on the post/page/custom post type.

Variable Name: $title
Type: string
Description: This is the title shown at the top of the alert email.

Variable Name: $message
Type: string
Description: The bulk of the alert email, such as the post contents.

Variable Name: $sender_details
Type: array
Description: Contains all data regarding the sender and recipients details for the alert.
For quick reference, the $sender_details['subscription_details'] array item contains details of the subscription itself, such as the post type, status, terms, keywords, etc. chosen at the time.

Variable Name: $links
Type: array
Description: Contains all links/buttons that show at the bottom of the alert body.

Variable Name: $post
Type: object
Description: Provides access to the $post object so that you can pull in additional information, such as custom field data.

Variable Name: $entry
Type: array
Description: Provides access to the subscriber’s details that relate to the alert being sent.

Hide/Show Based on Alert Type

You can conditionally show/hide certain aspects of your email alert by checking against the alert type.
The alert_type is part of the $sender_details PHP variable.

Here are some examples:

Not the verification email (admin and user alerts only)
if ( $sender_details['alert_type'] != 'cn\alert\type\verification' ) {}

Not the admin email (verification and user alerts only)
if ( $sender_details['alert_type'] != 'cn\alert\type\admin' ) {}

Not the user email (verification and admin alerts only)
if ( $sender_details['alert_type'] != 'cn\alert\type\user' ) {}

Only the verification emails
if ( $sender_details['alert_type'] == 'cn\alert\type\verification' ) {}

Only the admin emails
if ( $sender_details['alert_type'] == 'cn\alert\type\admin' ) {}

Only the user emails
if ( $sender_details['alert_type'] == 'cn\alert\type\user' ) {}

Either the admin or the user emails
if ( $sender_details['alert_type'] == 'cn\alert\type\admin' || $sender_details['alert_type'] == 'cn\alert\type\user' ) {}

Get started

Start using it today

Ready to transform your communications for your
visitors, members, subscribers, and users?

View Pricing

14-DAY MONEY BACK GUARANTEE
ON NEW PURCHASES

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Services provided by our payment processor, Stripe, require that Strictly Necessary Cookies are enabled in order to protect against fraudulent purchases and to allow purchases to be made.
Stripe's cookie policy can be found here: https://stripe.com/gb/legal/cookies-policy

This website uses YouTube to host and view videos relating to the operation of this plugin and forms part of the documentation. Use of cookies from YouTube is required in order to fully document or explain elements of the plugin.
Google's cookie policy can be found here: https://policies.google.com/privacy

This website uses the following additional cookies which can't be initially disabled but can be safely deleted:

  • PHPSESSID - This cookie is created upon logging in and is used by PHP to keep track of sessions. It can be deleted at any time but will be recreated the next time a login occurs.
  • moove_gdpr_popup - This cookie is created upon accepting/dismissing the cookie banner. It stores this state so that it doens't show repeatedly.