Newsletters: Dynamic Variables/Shortcodes

All emails sent through the WordPress Newsletter plugin (not just newsletters, but expiration notifications, confirmation emails, etc.) are parsed through a method which checks for certain dynamic variable tags in the content and replaces these tags with values based on their purpose. Below is a list of all the available dynamic variables, together with a description for each.

 

Predefined Variables Shortcodes

[newsletters_email] – Ouputs the email address of each individual subscriber.

[newsletters_subject] – Display the title/subject of this newsletter in the content.

[newsletters_historyid] – Display the history ID of this newsletter in the content.

[newsletters_unsubscribe] – Generates an unsubscription link for each individual subscriber.

[newsletters_blogname] – Outputs the title of your WordPress blog.

[newsletters_siteurl] – Outputs an absolute URL to your WordPress blog’s home page.

[newsletters_mailinglist] – Output the name of the mailing list being sent to.

[newsletters_activate] – Generates an activation/confirmation link for each subscriber for the specific mailing list.

[newsletters_activate_url] – Generates and activation/confirmation URL for each subscriber.

[newsletters_manage] – Generates a link which will automatically validate a subscriber without requiring him to insert his email address, and takes him to a subscription management page.

[newsletters_online] – Give your subscribers a link to view the newsletter online in their browser.

[newsletters_track] – Inserts a tracking code into each individual email to track its read status. Ensure that you have tracking turned on in the Configuration in order for this to work. The way it work is it adds a 1 px by 1 px invisible image to each email. Each individual email sent through the plugin gets a unique tracking code. Ultimately, the tracking code alerts the plugin when a email is read by seeing if the invisible image is loaded.

[newsletters_date {format} {time}] – By default, this shortcode is inserted into the newsletter content or template as [newsletters_date]. Optionally, a format parameter can be passed to it like this [newsletters_date format="%d/%m/%Y"] to define the format of the date. By default, the format is %d/%m/%Y. See the PHP strftime manual. You can also pass a time attribute to the shortcode, e.g., [newsletters_date time="+3 days"] and it supports any PHP strtotime string, date string or timestamp as a value.

[newsletters_bouncecount] – Output the total email bounces for the subscriber.

[newsletters_customfields] – Output all custom fields with values in a table for the subscriber.

[newsletters_subscriberscount] – Display the total number of subscribers in the database.

[newsletters_post_thumbnail] – Display the featured image of the current post. See the Post Thumbnail Shortcode documentation.

[newsletters_post_permalink] – Fetches the current post permalink.

[newsletters_print] – Will output a print link. The link will open a print preview of the newsletter and automatically open a print dialog as well.

[newsletters_online_url] –  Automatically generate a view online link.

[newsletters_bloginfo show=X] –  Will show blog name, description, URL, etc.

[newsletters_field name=X] – Will show name, country, IP address, device, format, etc. Any of your custom fields created under Newsletters > Custom Fields and other internal fields. To use a default value when a subscriber doesn’t have a value for the field, separate the field slug with a pipe (|) and the default value, e.g., [newsletters_field name=firstname|Reader]

 

Custom Fields Variables Shortcodes

Apart from these predefined dynamic variables available, each of your custom fields in the mailing list will have their own dynamic variable so that you can personalize newsletters sent out to your subscribers. For example, if you create a custom field with the title “Birth Date“, you later on insert the dynamic variable [wpmlfield name="birth_date"] into a newsletter to output the value of the custom field for each respectable subscriber.

 

Custom Link Shortcode

Use this shortcode [newsletters_subscribe_link list="1"]Subscribe link text[/newsletters_subscribe_link] to add a custom subscribe link to your newsletters or templates.

 

WordPress Posts into Newsletters

There is a quick and easy way to insert an excerpt of your WordPress posts into your newsletters. It basically just adds a shortcode and defines all the parameters within the shortcode depending on your selection. To use this feature, simple click the white Envelope icon at the top of the TinyMCE editor, like this:

Once you’ve clicked on the envelope icon it will bring up a small popup block. From the popup window choose ‘WP Posts’ tab at the top. Now from here you can choose to insert a single post or multiple posts.

The other fields vary depending on this selection. The other fields define the parameters of the shortcode, such as how many posts to insert, which option to order the posts by, ascending or descending order, and the post categories. The image below shows everything said above:

 

Single Post

    • post_id: The ID of the post to display.
    • showdate: Set this to “Y” to show the date of the post and “N” to not show it.
    • language: Language code for the language of the post when QTranslate is installed.
    • eftype: Set this to “full” to show the complete post or “excerpt” to show only a resume.
    • hidethumbnail: Set this to “Y” to hide the post thumbnail. Default behaviour is “N”, meaning that it will display the thumbnail.

 

Multiple Posts

  • language: This is only when QTranslate is installed and active and contains the language code.
  • numberposts: The number of posts that should be displayed,  you can limit the number of posts to display within a category.
  • showdate: This can be “Y” to show the date or “N” to show no post date.
  • orderby:: You can order post by the way you would like it to show like by date, Author, Category, Post_ID etc, rand.
  • order: The other fields define the parameters of the shortcode, such as how many posts to insert, which option to order the posts by, ascending or descending order, and the post categories.
  • category: Is determined by the number of the category you choose, ranging between one and however many categories you have.
  • category: Leaving the category parameter empty will send posts for all categories. e.g., category=""
  • post_type: Choose the custom post types to make posts from.
  • eftype: Set this to “full” to show the complete post or “excerpt” to show only a resume.
  • hidethumbnail: Set this to “Y” to hide post thumbnails. Default behaviour is “N”, meaning that it will display thumbnails.

So now you know how to insert an excerpt or the full text of your WordPress Posts into your newsletters, simply just choose the variables from the dropdowns according to your needs for the parameters.

 

Multiple Posts with selected Categories

 

Random Posts

Use this shortcode to show random posts in your newsletter or theme.

WordPress Plugins

Start selling products, sending newsletters, publishing ads, and more through your own WordPress website using our premium WordPress plugins.

Browse

Pin It on Pinterest