Conditional rendering of banners of social media

SoftTimur

Member
Hello,

I have been using MailWizz and Amazon SES to send newsletters. Recently, I also use stripo.io to create email templates and load them in MailWizz.

I would like to add a banner of social media at the bottom of emails.

Screenshot 2024-03-15 at 18.18.30.png

The problem is that the last 3 ones are Chinese. I have a field [Chinese] in the contacts to specify if a person is Chinese ("YES") or not ("NO"). I would like to show 5 social media if the recipient is Chinese; otherwise we only show 2 social media.

Does anyone know if we can achieve this conditional rendering in MailWizz?

Thank you
 
From backend > settings > campaigns > template engine, enable it. This will enable twig in your email campaigns:
https://twig.symfony.com/doc/3.x/tags/if.html
Thank you for your reply.

The html file that i export from stripo.io has the following code for the banner of social media:

```
<table cellpadding="0" cellspacing="0" class="es-table-not-adapt es-social" dir="ltr" role="presentation" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr>
<td align="center" valign="top" style="padding:0;Margin:0;padding-right:10px"><a target="_blank" href="https://www.linkedin.com" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;text-decoration:underline;color:#2CB543;font-size:14px"><img src="https://fbeyjgj.stripocdn.email/con...98b059832ab/images/linkedin_logo_initials.png" alt="In" title="LinkedIn" width="32" height="32" style="display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic"></a></td>
<td align="center" valign="top" style="padding:0;Margin:0;padding-right:10px"><a target="_blank" href="https://www.youtube.com" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;text-decoration:underline;color:#2CB543;font-size:14px"><img src="https://fbeyjgj.stripocdn.email/con...2e65fb465d0b98b059832ab/images/untitled_2.png" alt title="Custom" width="32" height="32" style="display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic"></a></td>
<td align="center" valign="top" style="padding:0;Margin:0;padding-right:10px"><a target="_blank" href="https://space.bilibili.com" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;text-decoration:underline;color:#2CB543;font-size:14px"><img src="https://fbeyjgj.stripocdn.email/con...832ab/images/xintuwang_bilibili_ixintucom.png" alt title="Custom" width="32" height="32" style="display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic"></a></td>
<td align="center" valign="top" style="padding:0;Margin:0;padding-right:10px"><a target="_blank" href="https://www.xiaohongshu.com" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;text-decoration:underline;color:#2CB543;font-size:14px"><img src="https://fbeyjgj.stripocdn.email/con...b465d0b98b059832ab/images/xiaohongshulogo.png" alt title="Custom" width="32" height="32" style="display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic"></a></td>
<td align="center" valign="top" style="padding:0;Margin:0"><a target="_blank" href="https://i.ibb.co" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;text-decoration:underline;color:#2CB543;font-size:14px"><img src="https://fbeyjgj.stripocdn.email/con...2e65fb465d0b98b059832ab/images/5njq9yr0q9.png" alt title="Custom" width="32" height="32" style="display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic"></a></td>
</tr>
</table>
```

Are you suggesting i could modify directly this html file like the follows, then load it in MailWizz?

```
<table>
<tr>
<td ...>... </td>
<td ...>... </td>
{% if user.chinese == "YES" %}
<td ...>... </td>
<td ...>... </td>
<td ...>... </td>
{% endif %}
</tr>
</table>
```
 
That's not something we can help with. You now have a way to use conditionals, that's up to you.
 
Back
Top