Skip to content

Instantly share code, notes, and snippets.

View naumanahmad17's full-sized avatar
🎯
Focusing

Nauman naumanahmad17

🎯
Focusing
  • @desginbee
  • Islamabad,Paksitan
View GitHub Profile
@naumanahmad17
naumanahmad17 / gist:8cc85c78e6c7a08aa6cbaf0d42babaff
Created September 11, 2020 04:35
Localize PHP Variables to JavaScript
function set_js_vars() {
wp_register_script( 'jsVars', '');
wp_localize_script( 'jsVars', 'page_urls', array(
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'homeURL' => get_home_url(),
'templateDir' => get_template_directory_uri(),
) );
wp_enqueue_script( 'jsVars' );
}
$url = 'https://api.sendgrid.com/';
$user = ' ';
$pass = '';
$json_string = array(
'to' => array('nauman@lbatechnologies.com')
);
$params = array(
'api_user' => $user,
'api_key' => $pass,
'x-smtpapi' => json_encode($json_string),