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 convert_kv(arr, k, v){ | |
| var temp = {}; | |
| for( var i = 0; i < arr.length; i++ ) { | |
| temp[arr[i][k]] = arr[i][v]; | |
| } | |
| return temp; | |
| } |
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
| Object.prototype.get_item_value = function(key, key_value, return_value_key ){ | |
| for( var i = 0; i < this.length; i++ ) { | |
| if( this[i][key] == key_value ) { | |
| return this[i][return_value_key]; | |
| } | |
| } | |
| return null; | |
| } |
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 | |
| // Front-end | |
| $args = [ ... ]; | |
| // query + loop here... | |
| if( !ff_have_more_posts( $args, count($q) ) ) return; | |
| echo '<button class="load-more-btn" onclick="load_more_posts(this)">Load more</button>'; | |
| ?> | |
| <script> | |
| var load_more = { |
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( 'wp_ajax_ajax_cache_test', 'ajax_cache_test' ); | |
| add_action( 'wp_ajax_nopriv_ajax_cache_test', 'ajax_cache_test' ); | |
| function ajax_cache_test(){ | |
| $data = []; | |
| $cache_file = ABSPATH . '/ajax-cache/'. $_POST['cache_key'] . '.json'; | |
| $time_start = microtime(true); | |
| $cache_duration = 21600; // 6hrs | |
| if( file_exists( $cache_file ) && (filemtime($cache_file) > (time() - $cache_duration)) ) { | |
| $data['debug'][] = 'from cache'; |
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
| selector .google-reviews-badge { | |
| display: inline-flex; | |
| height: 45px; | |
| border: 1px solid #E9ECEF; | |
| border-radius: 27px; | |
| background-color: #FFFFFF; | |
| align-items: center; | |
| padding: 5px 14px 5px 5px; | |
| } | |
| selector .google-reviews-badge:before { |
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
| $rating = 3.5; | |
| echo '<span class="rating_stars">'; | |
| echo '<span class="fill" style="width:'. (floatval($rating)/5)*100 .'%;"><span></span></span>'; | |
| echo '<span class="stars"></span>'; | |
| echo '</span>'; | |
| // Styles | |
| .rating_stars { | |
| position: relative; | |
| overflow: hidden; |
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 FF_Sticky(options){ | |
| if( window.outerWidth < 1024 ) return; | |
| var _ = this; | |
| _.options = options; | |
| _.el = _.options.el; | |
| _.el.addClass('ff-sticky-el'); | |
| _.el.wrap('<div class="ff_sticky_container">'); | |
| _.container = _.el.parent(); |
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 ff_convert_attachment_to_webp( $attachment_id ){ | |
| $guid = get_post_field('guid', $attachment_id); | |
| if( !$guid ) return; | |
| $file = str_replace( site_url() . '/', ABSPATH, $guid ); | |
| $convert_success = ff_convert_image_to_webp( $file, 100 ); | |
| if( $convert_success ) { | |
| $file_webp = str_replace('.'. pathinfo($file, PATHINFO_EXTENSION), '', $file) . '.webp'; | |
| update_attached_file( $attachment_id, $file_webp ); | |
| } | |
| } |
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
| // JS | |
| function scrolling_text(){ | |
| $('.h-scroll-text').each(function(){ | |
| var id = this.id; | |
| var el = $(this); | |
| var spacing = $(this).data('spacing') ? $(this).data('spacing') : 300; | |
| var speed = $(this).data('speed') ? $(this).data('speed') : 35; | |
| var text_con = el.find('.elementor-widget-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
| function phone_validation(){ | |
| var phone_is_valid = false; | |
| var phone = $('#billing_phone'); | |
| validate_phone( phone ); | |
| $( 'body' ).on( 'change', '#billing_phone', function(){ | |
| validate_phone( $(this) ) | |
| }); | |
| function validate_phone( el ){ |