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_head', 'load_critical_css', 0); | |
| function load_critical_css(){ | |
| $dir = FF_DIR .'/dist'; | |
| $handle = 'src/critical.js'; | |
| $manifest = FF\Vite\get_manifest($dir); | |
| if( !$manifest ) return; |
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
| /* | |
| !.gitignore | |
| **/.DS_Store | |
| **.log | |
| gitignore/ | |
| !wp-content |
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 | |
| class Upload_File { | |
| function upload_file( $file_url ) { | |
| $path_info = pathinfo($file_url); | |
| $file_name = $path_info['filename']; | |
| $attachment_id = $this->get_attachment_id_by_filename($file_name); | |
| if( !$attachment_id ) { | |
| // does not exist yet, upload |
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 | |
| function get_plugin_version($file){ | |
| $file_content = file_get_contents($file); | |
| $tokens = token_get_all( $file_content ); | |
| $comment = array( | |
| T_COMMENT, | |
| T_DOC_COMMENT, | |
| ); |
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
| $attachments = get_posts( array( | |
| 'post_type' => 'attachment', | |
| 'posts_per_page' => -1, | |
| 'post_parent' => $id, | |
| ) ); | |
| $images = []; | |
| foreach( $attachments as $attachment ) { | |
| $images[] = $attachment->guid; | |
| } |
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($){$(function(){ | |
| function FF_Filters(options){ | |
| var _ = this; | |
| this.options = options; | |
| _.filters_init(); | |
| _.search_init(); | |
| _.sort_init(); | |
| } |
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 | |
| $weather = get_transient( 'ff_weather' ); | |
| $location = 'Port Moresby'; | |
| if( !$weather ) { | |
| $api_key = 'ENTER_API_KEY_HERE'; | |
| $data = file_get_contents_curl('https://api.weatherapi.com/v1/current.json?key='. $api_key .'&q='. urlencode($location)); | |
| if( $data ) { | |
| $weather = json_decode($data); | |
| set_transient('ff_weather', $weather, 3600); // refresh once every hour | |
| } |
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 load_youtube_api(){ | |
| if( typeof YT !== 'undefined' ) return; | |
| var tag = document.createElement("script"); | |
| tag.src = "https://www.youtube.com/iframe_api"; | |
| var firstScriptTag = document.getElementsByTagName("script")[0]; | |
| firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | |
| } | |
| load_youtube_api(); |
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 limit_words_init(){ | |
| var els = document.querySelectorAll('.limit-words'); | |
| els.forEach(el=>{ | |
| var limit = parseInt(el.attributes.class.value.split('limit-value-')[1].split(' ')[0]); | |
| limit_words(el, limit); | |
| }); | |
| function limit_words(el, limit){ |
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 | |
| // Custom product status | |
| function register_custom_order_status() { | |
| register_post_status( 'wc-quote', array( | |
| 'label' => 'Quote', | |
| 'public' => true, | |
| 'show_in_admin_status_list' => true, | |
| 'show_in_admin_all_list' => true, | |
| 'exclude_from_search' => false, | |
| 'label_count' => _n_noop( 'Quote <span class="count">(%s)</span>', 'Quote <span class="count">(%s)</span>' ) |