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
| <!-- load only on IE --> | |
| <script>window.MSInputMethodContext && document.documentMode && document.write('<script src="https://cdn.jsdelivr.net/gh/nuxodin/ie11CustomProperties@4.1.0/ie11CustomProperties.min.js"><\/script>');</script> |
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 inline styles to some blocks | |
| wp.domReady = function() { | |
| const setExtraPropsToBlockType = (props, blockType, attributes) => { | |
| const notDefined = (typeof props.className === 'undefined' || !props.className) ? true : false | |
| if (blockType.name === 'core/heading') { | |
| return Object.assign(props, { | |
| style: 'line-height: 1; font-size: 24px; font-weight: 700; margin-top: 0; margin-bottom: 25px;', | |
| }); |
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
| /* | |
| * Remove wordpress responsive image markup for SVG | |
| */ | |
| add_filter( 'wp_calculate_image_sizes', 'remove_svgt_responsive_image_attr', 10, 3 ); | |
| function remove_svgt_responsive_image_attr( string $sizes, array $size, $image_src = null ) { | |
| $explode = explode( '.', $image_src ); | |
| $image_type = end( $explode ); | |
| if( $image_type === "svg" ){ |
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
| <script> | |
| window.onload = function(){ | |
| setTimeout(function(){ | |
| window.performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {}; | |
| var t = performance.timing || {}; | |
| if (!t) { | |
| 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
| add_action('wp_print_styles', function() { | |
| if ( ! doing_action( 'wp_head' ) ) { // ensure we are on head | |
| return; | |
| } | |
| global $wp_scripts, $wp_styles; | |
| // save actual queued scripts and styles | |
| $queued_scripts = $wp_scripts->queue; | |
| $queued_styles = $wp_styles->queue; | |
| // empty the scripts and styles queue | |
| $wp_scripts->queue = 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
| var httpRequest = new XMLHttpRequest(); | |
| httpRequest.onreadystatechange = ajaxDone; | |
| httpRequest.open('GET', '/url/endpoint/'); | |
| httpRequest.send(); | |
| function ajaxDone() { | |
| if (httpRequest.readyState === XMLHttpRequest.DONE) { | |
| if (httpRequest.status === 200) { | |
| // We got the `httpRequest.responseText`! | |
| } |
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
| module.exports = function(grunt) { | |
| grunt.initConfig({ | |
| pkg: grunt.file.readJSON('package.json'), | |
| // running `grunt sass` will compile once | |
| sass: { | |
| development: { | |
| options: { | |
| sourcemap: "none", |
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
| /** | |
| * ACF Custom Switch True or False | |
| * Design Inspiration: http://www.w3schools.com/howto/howto_css_switch.asp | |
| */ | |
| add_action('admin_head', 'perf_custom_switch'); | |
| function perf_custom_switch() { | |
| echo '<style> | |
| .switch { | |
| position: relative; | |
| display: inline-block !important; |
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
| # Delete a particular meta | |
| DELETE FROM wp_postmeta WHERE wp_postmeta.meta_key = '_upsell_ids'; | |
| DELETE FROM wp_postmeta WHERE wp_postmeta.meta_key = '_crosssell_ids'; | |
| # Delete all orpheline meta | |
| DELETE wp_postmeta FROM wp_postmeta | |
| WHERE NOT EXISTS ( | |
| SELECT * FROM wp_posts | |
| WHERE wp_postmeta.post_id = wp_posts.ID | |
| ) |