我已经创建了以下插件,该插件旨在用作自定义注册小部件。
class qfpregister extends WP_Widget
{
static private $login_registration_status;
static function registration_form()
{
$username = esc_attr($_POST[\'username\']);
$password = esc_attr($_POST[\'password\']);
$firstname = esc_attr($_POST[\'firstname\']);
$middlename = esc_attr($_POST[\'middlename\']);
$lastname = esc_attr($_POST[\'lastname\']);
$companyname = esc_attr($_POST[\'companyname\']);
$dateofbirth = esc_attr($_POST[\'dateofbirth\']);
$ssn = esc_attr($_POST[\'ssn\']);
$workaddress1 = esc_attr($_POST[\'workaddress1\']);
$workaddress2 = esc_attr($_POST[\'workaddress2\']);
$workcity = esc_attr($_POST[\'workcity\']);
$workstate = esc_attr($_POST[\'workstate\']);
$workzipcode = esc_attr($_POST[\'workzipcode\']);
$homeaddress1 = esc_attr($_POST[\'homeaddress1\']);
$homeaddress2 = esc_attr($_POST[\'homeaddress2\']);
$homecity = esc_attr($_POST[\'homecity\']);
$homestate = esc_attr($_POST[\'homestate\']);
$homezipcode = esc_attr($_POST[\'homezipcode\']);
$phone = esc_attr($_POST[\'phone\']);
$fax = esc_attr($_POST[\'fax\']);
$email = esc_attr($_POST[\'email\']);
$website = esc_attr($_POST[\'website\']);
$biography = esc_attr($_POST[\'biography\']);
$photofilename = esc_attr($_POST[\'photofilename\']);
$billingsameashome = esc_attr($_POST[\'billingsameashome\']);
$billingsameaswork = esc_attr($_POST[\'billingsameaswork\']);
$chfcearneddate = esc_attr($_POST[\'chfcearneddate\']);
$chfccert = esc_attr($_POST[\'chfccert\']);
$pfsearneddate = esc_attr($_POST[\'pfsearneddate\']);
$pfscert = esc_attr($_POST[\'pfscert\']);
$msfsearneddate = esc_attr($_POST[\'msfsearneddate\']);
$msfscert = esc_attr($_POST[\'msfscert\']);
$msearneddate = esc_attr($_POST[\'msearneddate\']);
$mscert = esc_attr($_POST[\'mscert\']);
$qfpearneddate = esc_attr($_POST[\'qfpearneddate\']);
$qfpcert = esc_attr($_POST[\'qfpcert\']);
$othercreds = esc_attr($_POST[\'othercreds\']);
$regtype = esc_attr($_POST[\'regtype\']);
$ccnumber = esc_attr($_POST[\'ccnumber\']);
$ccexpmonth = esc_attr($_POST[\'ccexpmonth\']);
$ccexpyear = esc_attr($_POST[\'ccexpyear\']);
$cvvnumber = esc_attr($_POST[\'cvvnumber\']);
$html =
\'<div>\';
$html .= \'<!-- Nav Tabs -->\';
$html .= \'<ul class="nav nav-tabs" role="tablist">\';
$html .= \'<li role="presentation" class="active"><a href="#contactinfo" aria-controls="contactinfo" role="tab"
data-toggle="tab">Contact Info</a></li>\';
$html .= \'<li role="presentation"><a href="#designations" aria-controls="designations" role="tab"
data-toggle="tab">Underlying Qualifying Designations</a></li>\';
$html .= \'<li role="presentation"><a href="#attestation" aria-controls="attestation" role="tab"
data-toggle="tab">Attestation</a></li>\';
$html .= \'</ul>\';
$html .= \'</div>\';
$html .= \'<div class="tab-content">\';
$html .= \'<div role="tabpanel" class="tab-pane active container-fluid" id="contactinfo">\';
$html .= \'<form action = "\' . $_SERVER[\'REQUEST_URI\'] . \'" method = "post" enctype="multipart/form-data">\';
$html .= \'<div class = "row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for = "username">Username <strong>*</strong></label>\';
$html .= \'<input type = "text" name = "username" placeholder = "username">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for = "firstname">First Name <strong>*</strong></label>\';
$html .= \'<input type = "text" name = "firstname" placeholder = "firstname">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for = "middlename">Middle Name </label>\';
$html .= \'<input type = "text" name = "middlename" placeholder = "middlename">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for = "lastname">Last Name <strong>*</strong></label>\';
$html .= \'<input type="text" name="lastname" placeholder= "lastname">\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html = \'<div class="col-md-3">\';
$html .= \'<label for = "passowrd">Password <strong>*</strong></label>\';
$html .= \'<input type = "password" name = "password" placeholder = "password">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for = "companyname">Company Name</label>\';
$html .= \'<input type="text" name="companyname" placeholder = "companyname">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="dateofbirth">Date of Birth <strong>*</strong></label>\';
$html .= \'<input type="date" name="dateofbirth" placeholder = "dateofbirth">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="ssn">Social Security Number <strong>*</strong></label>\';
$html .= \'<input pattern="{d3}-{d2}-{d4}" name="ssn" placeholder = "ssn">\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for = "phone">Phone Number <strong>*</strong></label>\';
$html .= \'<input type="text" name="phone" placeholder = "phone">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for = "fax">Fax</label>\';
$html .= \'<input type="text" name = "fax" placeholder = "fax">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="email">Email <strong>*</strong></label>\';
$html .= \'<input type="text" name = "email" placeholder = "email">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="website">Website</label>\';
$html .= \'<input type="text" name="website" placeholder ="website">\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label><strong>Business Address</strong></label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label><strong>Home Address</strong></label>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="workaddress1">Business Address 1</label>\';
$html .= \'<input type="text" name="workaddress1" placeholder ="workaddress1">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="homeaddress1">Home Address 1</label>\';
$html .= \'<input type="text" name="homeaddress1" placeholder ="homeaddress1">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="bio">Biography / Areas of Specialty</label>\';
$html .= \'<input type="text" name="bio" placeholder = "bio">\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="workaddress2">Business Address 2</label>\';
$html .= \'<input type="text" name="workaddress2" placeholder ="workaddress2">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="homeaddress2">Home Address 2</label>\';
$html .= \'<input type="text" name="homeaddress2" placeholder ="homeaddress2">\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="workcity">City</label>\';
$html .= \'<input type="text" name="workcity" placeholder ="workcity">\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="homecity">City</label>\';
$html .= \'<input type="text" name="homecity" placeholder ="homecity">\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="workstate">State</label>\';
$html .= \'<select name="workstate" type="text">\';
$html .= \'<option value="">Select...</option>\';
$html .= \'<option value="AL">Alabama</option>\';
$html .= \'<option value="AK">Alaska</option>\';
$html .= \'<option value="AZ">Arizona</option>\';
$html .= \'<option value="AR">Arkansas</option>\';
$html .= \'<option value="CA">California</option>\';
$html .= \'<option value="CO">Colorado</option>\';
$html .= \'<option value="CT">Connecticut</option>\';
$html .= \'<option value="DC">District of Columbia</option>\';
$html .= \'<option value="DE">Delaware</option>\';
$html .= \'<option value="FL">Florida</option>\';
$html .= \'<option value="GA">Georgia</option>\';
$html .= \'<option value="HI">Hawaii</option>\';
$html .= \'<option value="ID">Idaho</option>\';
$html .= \'<option value="IL">Illinois</option>\';
$html .= \'<option value="IN">Indiana</option>\';
$html .= \'<option value="IA">Iowa</option>\';
$html .= \'<option value="KS">Kansas</option>\';
$html .= \'<option value="KY">Kentucky</option>\';
$html .= \'<option value="LA">Louisiana</option>\';
$html .= \'<option value="ME">Maine</option>\';
$html .= \'<option value="MD">Maryland</option>\';
$html .= \'<option value="MA">Massachusetts</option>\';
$html .= \'<option value="MI">Michigan</option>\';
$html .= \'<option value="MN">Minnesota</option>\';
$html .= \'<option value="MS">Mississippi</option>\';
$html .= \'<option value="MO">Missouri</option>\';
$html .= \'<option value="MT">Montana</option>\';
$html .= \'<option value="NE">Nebraska</option>\';
$html .= \'<option value="NV">Nevada</option>\';
$html .= \'<option value="NH">New Hampshire</option>\';
$html .= \'<option value="NJ">New Jersey</option>\';
$html .= \'<option value="NM">New Mexico</option>\';
$html .= \'<option value="NY">New York</option>\';
$html .= \'<option value="NC">North Carolina</option>\';
$html .= \'<option value="ND">North Dakota</option>\';
$html .= \'<option value="OH">Ohio</option>\';
$html .= \'<option value="OK">Oklahoma</option>\';
$html .= \'<option value="OR">Oregon</option>\';
$html .= \'<option value="PA">Pennsylvania</option>\';
$html .= \'<option value="RI">Rhode Island</option>\';
$html .= \'<option value="SC">South Carolina</option>\';
$html .= \'<option value="SD">South Dakota</option>\';
$html .= \'<option value="TN">Tennessee</option>\';
$html .= \'<option value="TX">Texas</option>\';
$html .= \'<option value="UT">Utah</option>\';
$html .= \'<option value="VA">Virginia</option>\';
$html .= \'<option value="VT">Vermont</option>\';
$html .= \'<option value="WA">Washington</option>\';
$html .= \'<option value="WV">West Virginia</option>\';
$html .= \'<option value="WI">Wisconsin</option>\';
$html .= \'<option value="WY">Wyoming</option>\';
$html .= \'</select>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="homestate">State</label>\';
$html .= \'<select name="homestate" type="text">\';
$html .= \'<option value="">Select...</option>\';
$html .= \'<option value="AL">Alabama</option>\';
$html .= \'<option value="AK">Alaska</option>\';
$html .= \'<option value="AZ">Arizona</option>\';
$html .= \'<option value="AR">Arkansas</option>\';
$html .= \'<option value="CA">California</option>\';
$html .= \'<option value="CO">Colorado</option>\';
$html .= \'<option value="CT">Connecticut</option>\';
$html .= \'<option value="DC">District of Columbia</option>\';
$html .= \'<option value="DE">Delaware</option>\';
$html .= \'<option value="FL">Florida</option>\';
$html .= \'<option value="GA">Georgia</option>\';
$html .= \'<option value="HI">Hawaii</option>\';
$html .= \'<option value="ID">Idaho</option>\';
$html .= \'<option value="IL">Illinois</option>\';
$html .= \'<option value="IN">Indiana</option>\';
$html .= \'<option value="IA">Iowa</option>\';
$html .= \'<option value="KS">Kansas</option>\';
$html .= \'<option value="KY">Kentucky</option>\';
$html .= \'<option value="LA">Louisiana</option>\';
$html .= \'<option value="ME">Maine</option>\';
$html .= \'<option value="MD">Maryland</option>\';
$html .= \'<option value="MA">Massachusetts</option>\';
$html .= \'<option value="MI">Michigan</option>\';
$html .= \'<option value="MN">Minnesota</option>\';
$html .= \'<option value="MS">Mississippi</option>\';
$html .= \'<option value="MO">Missouri</option>\';
$html .= \'<option value="MT">Montana</option>\';
$html .= \'<option value="NE">Nebraska</option>\';
$html .= \'<option value="NV">Nevada</option>\';
$html .= \'<option value="NH">New Hampshire</option>\';
$html .= \'<option value="NJ">New Jersey</option>\';
$html .= \'<option value="NM">New Mexico</option>\';
$html .= \'<option value="NY">New York</option>\';
$html .= \'<option value="NC">North Carolina</option>\';
$html .= \'<option value="ND">North Dakota</option>\';
$html .= \'<option value="OH">Ohio</option>\';
$html .= \'<option value="OK">Oklahoma</option>\';
$html .= \'<option value="OR">Oregon</option>\';
$html .= \'<option value="PA">Pennsylvania</option>\';
$html .= \'<option value="RI">Rhode Island</option>\';
$html .= \'<option value="SC">South Carolina</option>\';
$html .= \'<option value="SD">South Dakota</option>\';
$html .= \'<option value="TN">Tennessee</option>\';
$html .= \'<option value="TX">Texas</option>\';
$html .= \'<option value="UT">Utah</option>\';
$html .= \'<option value="VA">Virginia</option>\';
$html .= \'<option value="VT">Vermont</option>\';
$html .= \'<option value="WA">Washington</option>\';
$html .= \'<option value="WV">West Virginia</option>\';
$html .= \'<option value="WI">Wisconsin</option>\';
$html .= \'<option value="WY">Wyoming</option>\';
$html .= \'</select>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for "workzip">Work Zip Code</label>\';
$html .= \'<input type="text" name="workzip" placeholder ="workzip"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="homezip">Home Zip Code</label>\';
$html .= \'<input type="text" name="homezip" placeholder ="homezip"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="billingsameashome">Billing Address Same as Home Address?</label>\';
$html .= \'<input type="checkbox" name="billingsameashome" placeholder ="billingsameashome"/><br/>\';
$html .= \'<label for="billingsameaswork">Billing Address Same as Work Address?</label>\';
$html .= \'<input type="checkbox" name="billingsameaswork" placeholder ="billingsameaswork"/><br/>\';
$html .= \'</div\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="photologfilename">Photo/Logo Filename</label>\';
$html .= \'<input type="file" name="photologfilename" placeholder ="photologofilename"/>\';
$html .= \'<input type="submit" name="contactnext"/>\';
$html .= \'</div>\';
$html .= \'</div>\'; // close tabpane
$html .= \'<div role="tabpanel" class="tab-pane container-fluid id="designations>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<input type="checkbox" name="chfcbox" placeholder ="chfcbox" />\';
$html .= \'<label for="chfcbox">ChFC© (The American College)</label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="chfcdate">Date Earned</label>\';
$html .= \'<input type="date" name="chfcdate" placeholder ="chfcdate"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="chfccert">Certificate#</label>\';
$html .= \'<input type="text" name="chfccert" placeholder ="chfccert"/>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<input type="checkbox" name="pfsbox" placeholder ="pfsbox" />\';
$html .= \'<label for="pfsbox">PFS™ (AICPA - American Institute of CPAs)</label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="pfsdate">Date Earned</label>\';
$html .= \'<input type="date" name="pfsdate" placeholder ="pfsdate"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="pfscert">Certificate#</label>\';
$html .= \'<input type="text" name="pfscert" placeholder ="pfscert"/>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<input type="checkbox" name="pfsbox" placeholder ="pfsbox" />\';
$html .= \'<label for="pfsbox">PFS™ (AICPA - American Institute of CPAs)</label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="pfsdate">Date Earned</label>\';
$html .= \'<input type="date" name="pfsdate" placeholder ="pfsdate"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="pfscert">Certificate#</label>\';
$html .= \'<input type="text" name="pfscert" placeholder ="pfscert"/>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<input type="checkbox" name="cfpbox" placeholder ="cfpbox" />\';
$html .= \'<label for="pfsbox">CFP© (CFP Board)</label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="cfpdate">Date Earned</label>\';
$html .= \'<input type="date" name="cfpdate" placeholder ="cfpdate"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="cfpcert">Certificate#</label>\';
$html .= \'<input type="text" name="cfpcert" placeholder ="cfpcert"/>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<input type="checkbox" name="msfsbox" placeholder ="msfsbox" />\';
$html .= \'<label for="msfsbox">MSFS (The American College)</label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="msfsdate">Date Earned</label>\';
$html .= \'<input type="date" name="msfsdate" placeholder ="msfsdate"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="msfscert">Certificate#</label>\';
$html .= \'<input type="text" name="msfscert" placeholder ="msfscert"/>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<input type="checkbox" name="msbox" placeholder ="msbox" />\';
$html .= \'<label for="msbox">MS (College for Financial Planning)</label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="msdate">Date Earned</label>\';
$html .= \'<input type="date" name="msdate" placeholder ="msdate"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="mscert">Certificate#</label>\';
$html .= \'<input type="text" name="mscert" placeholder ="mscert"/>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<input type="checkbox" name="pfsbox" placeholder ="pfsbox" />\';
$html .= \'<label for="pfsbox">PFS™ (AICPA - American Institute of CPAs)</label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="pfsdate">Date Earned</label>\';
$html .= \'<input type="date" name="pfsdate" placeholder ="pfsdate"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="pfscert">Certificate#</label>\';
$html .= \'<input type="text" name="pfscert" placeholder ="pfscert"/>\';
$html .= \'</div>\';
$html .= \'<hr>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<input type="checkbox" name="qfpbox" placeholder ="qfpbox" />\';
$html .= \'<label for="qfpbox">QFP (Qualified Financial Planner)</label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="qfpdate">Date Earned</label>\';
$html .= \'<input type="date" name="qfpdate" placeholder ="qfpdate"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="qfpcert">Certificate#</label>\';
$html .= \'<input type="text" name="qfpcert" placeholder ="qfpcert"/>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="othercreds">Other Credentials or Designations (e.g. CPA, CLU, Esq.)</label>\';
$html .= \'<input type="text" name="othercreds" placeholder ="othercreds"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<input type="submit" name="designationnext" value="Next"/>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'</div>\'; // close designations tab
$html .= \'<div role="tabpanel" class="tab-pane container-fluid" id="attestation">\';
$html .= \'<div class="row">\';
$html .= \'<div class="col-md-3">\';
$html .= \'<div class="btn-group" data-toggle="buttons">\';
$html .= \'<label class="btn btn-primary">\';
$html .= \'<input type="radio" name="options" id="membership">Membership (Includes Full Listing in QFP Registry):\';
$html .= \'</label>\';
$html .= \'<label class="btn btn-primary">\';
$html .= \'<input type="radio" name="options" id="nonmember">Non-Membership / QFP Registrant Only:>\';
$html .= \'</label>\';
$html .= \'<label class="btn btn-primary">\';
$html .= \'<input type="radio" name="options" id="nocharge">N/C for First Year QFP Registry Registrants (Includes Name & QFP Only - Must select Membership Above for Full Registry Lising):>\';
$html .= \'</label>\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="ccnumber">Credit Card Number</label>\';
$html .= \'<input type="text" name="ccnumber" placeholder ="ccnumber"/>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="expmonth">Expiration Month</label>\';
$html .= \'<select name="expmonth" type="text">\';
$html .= \'<option value="">Select...</option>\';
$html .= \'<option value="1">January</option>\';
$html .= \'<option value="2">February</option>\';
$html .= \'<option value="3">March</option>\';
$html .= \'<option value="4">April</option>\';
$html .= \'<option value="5">May</option>\';
$html .= \'<option value="6">June</option>\';
$html .= \'<option value="7">July</option>\';
$html .= \'<option value="8">August</option>\';
$html .= \'<option value="9">September</option>\';
$html .= \'<option value="10">October</option>\';
$html .= \'<option value="11">November</option>\';
$html .= \'<option value="12">December</option>\';
$html .= \'</select>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-3">\';
$html .= \'<label for="expyear">Expiration Year</label>\';
$html .= \'<select name="expyear" type="text">\';
$html .= \'<option value="2016">2016</option>\';
$html .= \'<option value="2017">2017</option>\';
$html .= \'<option value="2018">2018</option>\';
$html .= \'<option value="2019">2019</option>\';
$html .= \'<option value="2020">2020</option>\';
$html .= \'<option value="2021">2021</option>\';
$html .= \'<option value="2022">2022</option>\';
$html .= \'<option value="2023">2023</option>\';
$html .= \'<option value="2024">2024</option>\';
$html .= \'<option value="2025">2025</option>\';
$html .= \'<option value="2026">2026</option>\';
$html .= \'</select>\';
$html .= \'<label for="cvvcode">CVV Code</label>\';
$html .= \'<input type="text" name="cvvcode" placeholder ="cvvcode">\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'<div class="row">\';
$html .= \'<div class = "col-md-6">\';
$html .= \'<label border-width="1px">
Next I, \';
echo $firstname;
\' \';
echo $lastname;
\' hereby attest, under penalty of perjury and subject to
a monetary penalty of not less than $10,000, that I hae earned or been granted or one
or more of the herein indicated underlying qualifying designations of
Financial Planning, and that I have not here made any false or misleading
representations.
</label>\';
$html .= \'</div>\';
$html .= \'<div class="col-md-6">\';
$html .= \'<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Code-of-Ethics-Professional-Conduct.pdf" target="_blank">IAQFP Code of Ethics and Professional Conduct</a>\';
$html .= \'<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Disciplinary-Procedures-Complaint-Process.pdf" target="_blank">IAQFP Disciplinary Procedures and Complaint Process</a>\';
$html .= \'<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Certified-Financial-Planners-QFP-Designation-Usage-Guidelines.pdf" target="_blank">IAQFP Certified Financial Planner Usage Guidelines</a>\';
$html .= \'<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Continuing-Education-Requirements.pdf" target="_blank">IAQFP Continuing Education Requirements</a>\';
$html .= \'<a href="https://iaqfp.org/wp-content/uploads/2016/06/IAQFP-Membership-Agreement.pdf" target="_self"> IAQFP Membership Agreement</a>\';
$html .= \'<input type="submit" name="reg_submit" value="I Agree />\';
$html .= \'</div>\';
$html .= \'</div>\';
$html .= \'</div>\'; // close attestation tab
$html .= \'</form>\';
$html .= \'</div>\';
$html .= \'</div> \';
return $html;
$userdata = array(
\'email\'=>$email,
\'username\'=>$username,
\'password\'=>$password,
);
$userid = wp_insert_user($userdata);
$data = array(
\'firstname\'=> $firstname,
\'middlename\'=> $middlename,
\'lastname\'=> $lastname,
\'workaddress1\' => $workaddress1,
\'workaddress2\' => $workaddress2,
\'workcity\' => $workcity,
);
foreach($data as $k => $v){
update_user_meta($userid, $k, v);
}
if(is_wp_error($userid)){
echo \'User registration failed\';
}
else{
echo \'User registration succeeded. We will verify credentials and follow up via email.\';
}
}
}
function register_qfpform(){
register_widget(\'registration_form\');
add_action(\'widgets_init\', \'register_qfpform\');
}
}
在将插件安装到我的本地Wordpress站点之后,qfpregister小部件没有在我的可用小部件页面中列出。还需要哪些其他步骤来确保小部件可用?
最合适的回答,由SO网友:Tim Malone 整理而成
这不起作用的原因有很多。最好的出发点是Widgets API page in the Codex. 它概述了创建小部件的基本类。至少,您需要一个具有__construct()
, widget()
, form()
, 和update()
作用
您还需要正确注册小部件。这个register_widget()
function 将小部件的类作为其参数,而此时您正在通过函数名发送。
您的widget注册也永远不会被调用,因为您的钩子只添加到它调用的函数中:这意味着它永远不能被添加,因为它从未被调用过。
将小部件注册移到类外,并按如下方式进行设置:
function register_qfpform(){
register_widget(\'qfpregister\');
}
add_action(\'widgets_init\', \'register_qfpform\');
您可以在
Codex\' Plugin API page.
之后,您需要查看registration_form()
函数,并可能将大部分代码移动到widget()
作用这个widget()
函数输出小部件的前端代码,而form()
函数输出后端代码。您当前的registration_form()
功能也很差-有一个return;
最后,在更新代码之前,这意味着更新代码永远不会运行。
还有一点不清楚您试图做什么:函数返回变量的内容$html
, 但也有一些echo
在此之前的语句将直接呼应该人的名字和姓氏,而不在表单的其余流程中。
我会告诉你Widgets API page in the Codex. 以这里的例子为基础,并以此为基础。您现在拥有的是一堆无法工作的代码。