This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Updates .htaccess, regenerates WP Rocket config file. | |
*/ | |
function flush_wp_rocket() { | |
if ( ! function_exists( 'rocket_generate_config_file' ) ) { | |
return false; | |
} | |
// Regenerate WP Rocket config file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#Visual Composer field dependency examples: | |
array( | |
"type" => "attach_image", | |
"holder" => "div", | |
"param_name" => "section_title_image", | |
"dependency" => [ | |
"element" => "title_type", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Format string to SSN (Social Security Number) in the format of XXX-XX-XXXX | |
function string_to_ssn( $ssn = "111223333" ) { | |
return substr($ssn, 0, 3).'-'.substr($ssn, 3, 2).'-'.substr($ssn,5); | |
} | |
// Format string to SSN by preg_replace | |
function string_to_ssn_2( $ssn = "111223333" ) { | |
$ssn = preg_replace('/[^\d]/', '', $ssn); | |
$ssn = preg_replace('/^(\d{3})(\d{2})(\d{4})$/', '$1-$2-$3', $ssn); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sfurl = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8'; | |
$sffields = array( | |
'oid' => 'someoid', | |
'lead_source' => 'my website', | |
'last_name' => urlencode($_POST['name']), | |
'company' => urlencode($_POST['organization']), | |
'email' => urlencode($_POST['email']), | |
'phone' => urlencode($_POST['phone']), | |
); | |
foreach($sffields as $key=>$value) { $fieldstring .= $key.'='.$value.'&'; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AD : Andorra | |
AE : United Arab Emirates | |
AF : Afghanistan | |
AG : Antigua and Barbuda | |
AI : Anguilla | |
AL : Albania | |
AM : Armenia | |
AN : Netherlands Antilles | |
AO : Angola | |
AQ : Antarctica |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Afghanistan | |
Aland Islands | |
Albania | |
Algeria | |
American Samoa | |
Andorra | |
Angola | |
Anguilla | |
Antarctica | |
Antigua and Barbuda |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Third party links will be opened in a new tab/window | |
$("a").filter(function () { | |
return this.hostname && this.hostname.replace('www.', '') !== location.hostname.replace('www.', ''); | |
}).attr('target', '_blank'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// WP Add Remove Body Classes | |
// Add | |
add_filter( 'body_class','mh_body_classes' ); | |
function my_body_classes( $classes ) { | |
$classes[] = 'class-name'; | |
$classes[] = 'class-name-two'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Validate DOB 18 years or not | |
jQuery.validator.addMethod( "stValidDOB", function(value, element) { | |
var dob = value.split("-"); | |
var year = dob[0]; | |
var month = dob[1]; | |
var day = dob[2]; | |
var age = 18; | |
var mydate = new Date(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add Custom method for Email validation | |
jQuery.validator.addMethod("stEmail", function(value, element) { | |
return this.optional( element ) || /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( value ); | |
}, 'Please enter a valid email address.'); |
NewerOlder