Hello! It is possible with a custom shortcode. Here is an example:
add_filter('mailpoet_newsletter_shortcode', 'mailpoet_custom_shortcode', 10, 6);
function mailpoet_custom_shortcode($shortcode, $newsletter, $subscriber, $queue, $newsletter_body, $arguments) {
// always return the shortcode if it doesn't match your own!
if ($shortcode !== '[custom:czech_name]') return $shortcode;
$name = $subscriber->getFirstName();
return $name ? apply_czech_name_ending($name) : 'abonent';
}
The implementation of the apply_czech_name_ending()
function which will translate Peter to Pet?e etc. is left to you, obviously. There are probably libraries for that on the web. Add the resulting code to your functions.php
. After that you’ll be able to add the [custom:czech_name]
shortcode to your newsletter, and Czech name endings will appear in the content.
Please see the custom shortcode reference for more detail: https://kb.mailpoet.com/article/160-create-a-custom-shortcode