Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16417

    Copy a piece of code from the Internet:

    How to automatically email contributors when their posts are published,Copy the code below and paste it on my functions.php file.

    function wpr_authorNotification($post_id) {

    $post = get_post($post_id);

    $author = get_userdata($post->post_author);

    $message = “

    Hi “.$author->display_name.”,

    Your post, “.$post->post_title.” has just been published. Well done!

    “;

    wp_mail($author->user_email, “Your article is online”, $message);

    }

    add_action(‘publish_post’, ‘wpr_authorNotification’);

    “Your article is online” and “ has just been published. Well done!” for other languages​​,How to modify the code and po files?Thank you for your help!

    #91435

    Hi cxxc,

    We aren’t really able to support third party applications, code, functions, plugins etc. You will have better luck with the WPML forums if that is what you are using.

    Regards,

    Devin

    #91436

    Thank you for your reply!

    Multilingual Blog Versions are supported?

    #91437

    You can rewrite the code a bit – instead of:

    $message = "
    Hi ".$author->display_name.",
    Your post, ".$post->post_title." has just been published. Well done!
    ";
    wp_mail($author->user_email, "Your article is online", $message);
    }

    use:

    $message = __('Hi ','avia_framework').$author->display_name.",".__('Your post, ','avia_framework').$post->post_title.__('has just been published. Well done!','avia_framework');
    wp_mail($author->user_email, __("Your article is online",'avia_framework'), $message);

    and you should be able to translate the text with po/mo files. You’ll need to generate them first though – use tools like poedit for this task.

    #91438

    Great!

    This is just what I want …

    Thank you very much!

    #91439

    Hi!

    Glad that I could help you :)

    Regards,

    Peter

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Custom translation entries’ is closed to new replies.