Archive for the ‘wordpress’ Category

WordPress Hooks Easy Map

Action Hook is used to run custom functions at a specific point during the execution of WordPress Core. Filter Hook is used to modify or customize and return data used by other functions.

Updating custom db table in WordPress

function my_function() { global $wpdb; $wpdb->update(’wp_my_appointments’, array( ‘title’ => ‘Msc’, ‘msg’ => ‘Message’ ),array(id => 3)); }

Inserting in custom db table in WordPress

function my_function() { global $wpdb; $wpdb->insert(’wp_my_appointments’, array( ‘title’ => ‘Mr’, ‘msg’ => ‘Message’ ),array( ‘%s’, ‘%s’)); }

Selecting from db custom table in WordPress

function my_function() { global $wpdb; $appointments = $wpdb->get_results("SELECT * FROM wp_my_appointments;"); echo ‘<pre>’; print_r($appointments); }

Sending email in WordPress

$to = ‘your@emailaddress.com’; $subject = ‘The subject’; $body = ‘The email body content’; $headers = array(’Content-Type: text/html; charset=UTF-8’);   wp_mail( $to, $subject, $body, $headers );