Skip to content

Instantly share code, notes, and snippets.

@viruthagiri
Created February 1, 2012 18:27
Show Gist options
  • Save viruthagiri/1718485 to your computer and use it in GitHub Desktop.
Save viruthagiri/1718485 to your computer and use it in GitHub Desktop.
Custom functions
<?php
global $shortcode_tags;
echo "<pre>"; print_r($shortcode_tags); echo "</pre>";
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 has been published. Please check the article and let us know if anything needs to be changed. Please do not forget to Tweet, Like, and Google +1 the article. ", $message);
}
add_action('publish_post', 'wpr_authorNotification');
add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');
function new_mail_from($old) {
return 'no-reply@example.com';
}
function new_mail_from_name($old) {
return 'Dave Thomas';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment