Customise inserted content
Change the way the content you insert in your emails look like using CSS or a custom view.
Last updated
Change the way the content you insert in your emails look like using CSS or a custom view.
Last updated
AcyMailing offers the possibility to easily insert your site's content directly in your emails, be it a site article/post, a product from your preferred e-commerce extension or the upcoming events...
AcyMailing offers a lot of options to fully customise the inserted content by letting you choose which parts of the content it should insert (the title, the main picture, the description, a read more link, etc...):
You can then change the way these parts are organised using the Format section, we prepared a lot of default formats you can pick:
If this isn't enough for your needs, you have the possibility to apply custom CSS code to the inserted content.
You can add your CSS code when editing your email, in its Settings section:
For every integration we have for content insertion (site article, product, event, etc...) we use the same CSS classes:
acymailing_content: on the <div> element containing all the inserted content
acym_title: on the <h2> element containing the title
acydescription: on the <div> element containing both the main picture and the description
content_main_image: on the main picture <img>, if any
acymailing_readmore_link: on the read more link <a>
acymailing_readmore: on the <span> element inside the read more link
Note that in the screenshot above, the first options let you change the way the main HTML elements look like. If you change the <h2> element for example, it will be applied on the titles of the inserted articles without you having to do some custom CSS.
In some cases, changing the CSS isn't sufficient. If this is your case, you have the possibility to change the HTML structure of inserted content by building your own custom view.
Note that if you create a custom view it will totally replace the normal output. This means that the insertion options on the right are not taken into account anymore (the Display, Format, Pictures sections, etc...).
To create one you can either go in the settings of an add-on that inserts content and then click on the button Edit custom view, or you can find a similar button below the insertion options when inserting the content:
A popup should appear, with a default view that you can replace / customise as you want:
The data available to include is shown on the right of the screen. First click somewhere in the edition part, then then click on "title" for example to include it where your cursor is in the edition part.
Once you're satisfied with the structure, click the Save button to automatically use it each time an article is inserted in an email.
For security reasons, it isn't possible to use PHP code in the custom view, you only have access to HTML elements and the data shown on the right. You then won't be able to customise the format for date fields for example.