‌ওয়ার্ডপ্রেসে থিম সক্রিয় হলেই ডেভেলপার মেইল পাবে

আপনি যদি চান আপনার ডেভেলপ করা থিম কোন ‌ওয়েবসাইটে সক্রিয় হবার সাথে সাথে আপনার কাছে উক্ত সাইটের মেইল আসবে তাহলে কেমন হয়! সাখে ‌উক্ত ওয়েবসাইটের ঠিকানা, থিমের নাম এবং অ্যাডমিনের মেইল ঠিকানা। আপনি চাইলে আরো কিছু তথ্য যুক্ত করতে পারেন যা আপনি মেইলের মাধ্যমে পেতে চান।
এজন্য নিচের কোড থিমের functions.php ফাইলে কপি/পেস্ট করে সেভ করুন।

/* Send Mail After Setup Theme*/
function set_mail_html_content_type() {
return 'text/html';
}

add_action('after_switch_theme', 'royal_mail_me');

function royal_mail_me (){
$to = '[email protected]';
$subject = 'Your theme ('.$theme_name.') activated';
$site = site_url();
$theme_name = get_current_theme();
$admin_email = get_option( 'admin_email' );
$message = '
Dear Developer,
('.$site.') website has been activated your theme ('.$theme_name.').
Admin mail : '.$admin_email'. '; add_filter( 'wp_mail_content_type', 'set_mail_html_content_type' ); wp_mail( $to, $subject, $message ); remove_filter( 'wp_mail_content_type', 'set_mail_html_content_type' ); }

ব্যাস এবার থিমটি সক্রিয় করে (লোকালহোস্টে হলে মেইল আসবে না) দেখেন আপনার মেইলে মেইল এসেছে।

৫ Comments on "‌ওয়ার্ডপ্রেসে থিম সক্রিয় হলেই ডেভেলপার মেইল পাবে"

×
কপিরাইট © ২০০৬-২০২৪ সমকাল দর্পণ. সর্বস্বত্ব সংরক্ষিত।
সার্বিক তত্ত্বাবধানে রয়েল টেকনোলজিস