Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

nikki007 on "wp_cron usage"

$
0
0

I customized a spider calendar plugin which shows today's birthdays and current months list of wedding anniversaries in the home page of the site. i wrote a code in that plguin's displaying page using wp_mail and mail will send. but this happens only when the site is visited. my code:

if($dat==date('Y-m-d'))/*$dat is the date of event from DB*/
 {
  if($eid!=''){ /*if recipient email id is not null*/
 if($se!=1)  /*if email is sending first time then($se=db column 'send'value) $se=0    otherwise it is 1*/
  {
    $to=$eid;
    $sub="Birthday Wishes";
    $msg='Happy Birthday '.$ev_title[$j];
    $headers= 'From:Mysite <noreply@mysite.com>' . "\r\n".'Content-type: text/html';
    $attachments=array(WP_CONTENT_DIR . '/plugins/spider-event-calendar/images/happybday.gif');
    $rx=wp_mail($to,$sub,$msg,$headers,$attachments);
    $wpdb->update($wpdb->prefix.  "spidercalendar_event",array('send'=>1),array('id'=>$ev_id[$j]));/**/
    //echo "email send";
    }
  else{
  //echo "email already sent";
      }
    }
  }

i heard aboywp_cron. as i'm a newbie can anyone please tell me how should i write a cron from the above function to perform.and how to start the cron.


Viewing all articles
Browse latest Browse all 8245

Trending Articles