• Resolved ferda2

    (@ferda2)


    Hi, I need to use Czech name endings in the address. Possible?

    Examples:

    Peter – Ahoj Pet?e
    Pavel – Ahoj Pavle

    etc.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author wxa1

    (@wxa1)

    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

    Thread Starter ferda2

    (@ferda2)

    Excellent, thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.