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
function cf7_check_email_field($result, $tags) { | |
$wpcf = WPCF7_ContactForm::get_current(); | |
// Check if the current form ID is 9052 | |
if ($wpcf->id !== 9052) { | |
return $result; | |
} | |
// Get the posted email data | |
$submission = WPCF7_Submission::get_instance(); |
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
/* | |
* Block URLs from inside form on Single Line Text and Paragraph Text form fields | |
* | |
* @link https://wpforms.com/developers/how-to-block-urls-inside-the-form-fields/ | |
*/ | |
function wpf_dev_check_for_urls( $field_id, $field_submit, $form_data ) { | |
if( strpos($field_submit, 'http') !== false || strpos($field_submit, 'www.') !== false ) { | |
wpforms()->process->errors[ $form_data[ 'id' ] ][ $field_id ] = esc_html__( 'No URLs allowed.', 'wpforms' ); |
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 | |
/** | |
* My Account Dashboard | |
* | |
* Shows the first intro screen on the account dashboard. | |
* | |
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/dashboard.php. | |
* | |
* HOWEVER, on occasion WooCommerce will need to update template files and you | |
* (the theme developer) will need to copy the new files to your theme to |
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_filter( 'woocommerce_download_file_redirect', 'stop_download_after_checkout', 10, 2 ); | |
function stop_download_after_checkout( $redirect, $download_id ) { | |
$redirect = false; | |
return $redirect; | |
} |
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
/* | |
Usage: | |
usort($array, array($this, "date_compare")); | |
To sort DESC use return $t2 - $t1 | |
To sort ASC use return $t1 - $t2 | |
*/ | |
public function date_compare($a, $b) | |
{ |
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
/* | |
Usage: | |
create array of time ranges | |
$times = create_time_range('9:30', '17:30', '30 mins'); | |
more examples: | |
$times = create_time_range('9:30am', '5:30pm', '30 mins'); | |
$times = create_time_range('9:30am', '5:30pm', '1 mins'); | |
$times = create_time_range('9:30am', '5:30pm', '30 secs'); |