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 | |
/** | |
* Validates the custom mask date field format MM/YYYY. | |
*/ | |
add_filter('gform_field_validation_8', function($result, $value, $form, $field) { | |
$date_field_ids = [119, 120, 121]; // Field IDs of the custom date field | |
if (!in_array($field->id, $date_field_ids)) { | |
return $result; | |
} |
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 | |
add_action('template_redirect', 'redirect_old_post_urls'); | |
function redirect_old_post_urls() { | |
if (is_404()) { | |
global $wp; | |
$request = $wp->request; | |
$post = get_page_by_path($request, OBJECT, 'post'); | |
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 | |
// append custom parameters to YouTube iframe to enable JS API | |
$custom_parameters = '&rel=0&enablejsapi=1'; | |
// Append custom parameters to the src attribute of the iframe | |
$modified_iframe = preg_replace('/src="(.*?)"/', 'src="$1' . $custom_parameters . '"', $video_iframe); | |
// For Vimeo video, make sure to append ?api=1 |
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 | |
$mailer = WC()->mailer(); | |
$template = '/emails/customer-admin-order-status.php'; | |
//format the email | |
$subject = 'Order Status Update'; | |
$content = wc_get_template_html( $template, array( | |
'order' => $order, |
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 | |
/** | |
* Multiple instances of same GF form on the same page | |
*/ | |
add_filter( 'gform_get_form_filter_1', 'gform_get_form_filter_handler', 10, 2 ); | |
add_filter( 'gform_confirmation_1', 'gform_get_form_filter', 10, 2 ); | |
function gform_get_form_filter_handler( $form_string, $form ){ | |
// if form has been submitted, use the submitted ID, otherwise generate a new unique ID | |
if ( isset( $_POST['gform_random_id'] ) ) { | |
$random_id = absint( $_POST['gform_random_id'] ); // Input var okay. |
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
$imagePath: "assets/images"; | |
$breakpoints: ( | |
sm: 576px, | |
md: 768px, | |
lg: 992px, | |
xl: 1200px, | |
xxl: 1400px, | |
); |
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 | |
add_shortcode('read_more_less', 'read_more_less_button_handler'); | |
function read_more_less_button_handler( $attrs, $content ){ | |
$title = $attrs['title']; | |
if( !$title ) | |
$title = "Learn More"; | |
return ' | |
<div class="readmorelessbutton-container"> |
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
<!-- Change POSTER, MP4_URL, WEBM_URL and OGG_URL --> | |
<!-- Might need to add some height to main element --> | |
<div class="video-hero jquery-background-video-wrapper demo-video-wrapper"> | |
<video class="jquery-background-video" autoplay muted loop poster="POSTER"> | |
<source src="MP4_URL" type="video/mp4"> | |
<source src="WEBM_URL" type="video/webm"> | |
<source src="OGG_URL" type="video/ogg"> | |
</video> | |
<div class="video-hero--content"></div> | |
</div> |
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 | |
// Admin -> WC -> Settings -> Advanced -> Page Setup | |
add_filter( 'woocommerce_settings_pages' , 'add_new_woocommerce_settings_pages' ); | |
function add_new_woocommerce_settings_pages( $settings ){ | |
$new_pages = array(); | |
foreach( $settings as $s ){ | |
if( $s['id'] == 'advanced_page_options' ){ | |
$new_pages[] = array( |
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 | |
// ONLY FOR TESTING | |
add_filter("gform_pre_render", "gform_skip_page"); | |
function gform_skip_page($form) { | |
if(!rgpost("is_submit_{$form['id']}") && rgget('form_page')) | |
GFFormDisplay::$submission[$form['id']]["page_number"] = rgget('form_page'); | |
return $form; | |
} |
NewerOlder