This file contains 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
// pretty-format phone inputs | |
( function( $ ) { | |
$(function() { | |
$('.gform_wrapper').on('input','[type="tel"]' , function (){ | |
var phoneNumber = $(this).val(); | |
// Remove Non numeric input | |
var numericPhoneNumber = phoneNumber.replace(/\D/g, ''); | |
This file contains 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
/** | |
* Remove p wrapper on image tags in content | |
* | |
*/ | |
function filter_ptags_on_images($content) { | |
$content = preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); | |
return preg_replace('/<p>\s*(<iframe .*>*.<\/iframe>)\s*<\/p>/iU', '\1', $content); | |
} | |
add_filter('acf_the_content', 'filter_ptags_on_images'); | |
add_filter('the_content', 'filter_ptags_on_images'); |
This file contains 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 custom_about_us_news_rewrite_rule() { | |
add_rewrite_rule('^about-us/news/([^/]+)/?$', 'index.php?name=$matches[1]', 'top'); | |
} | |
add_action('init', 'custom_about_us_news_rewrite_rule'); | |
function custom_about_us_news_permalink($permalink, $post) { | |
if ($post->post_type == 'post') { | |
$permalink = home_url('about-us/news/' . $post->post_name); | |
} | |
return $permalink; |
This file contains 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
$(window).scroll(function(){ | |
var a = 0; | |
var oTop = $(".counter-container").offset().top - window.innerHeight; | |
if (a == 0 && $(window).scrollTop() > oTop) { | |
$('.number-title').each(function () { | |
var $this = $(this); | |
jQuery({ Counter: 0 }).animate({ Counter: $this.attr("data-counter") }, { |
This file contains 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 | |
/** | |
* Get youtube or vimeo video thumbnail from video url | |
* | |
*/ | |
function fx_get_video_thumbnail($url) { | |
// Check if url is valid | |
$image_src = NULL ; |
This file contains 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 | |
function hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { | |
if ( 'free_shipping' === $rate->method_id ) { | |
$free[ $rate_id ] = $rate; | |
break; | |
} |