Consider supporting my work by purchasing the course this tutorial is a part of i.e. VSCode Power User →
- Make sure your
Local by FlyWheel
WordPress install is a custom install
<?php | |
add_action('plugins_loaded','ao_defer_inline_init'); | |
function ao_defer_inline_init() { | |
if ( get_option('autoptimize_js_include_inline') != 'on' ) { | |
add_filter('autoptimize_html_after_minify','ao_defer_inline_jquery',10,1); | |
} | |
} | |
function ao_defer_inline_jquery( $in ) { |
Consider supporting my work by purchasing the course this tutorial is a part of i.e. VSCode Power User →
Local by FlyWheel
WordPress install is a custom install{ | |
// ECHO | |
"PHP Echo Tag": { | |
"prefix": "echo", | |
"body": [ | |
"<?php echo ${1:\\$var}; ?>" | |
], | |
"description": "Expand \"echo\" into PHP echo block" | |
}, | |
function formatBytes(bytes,decimals) { | |
if(bytes == 0) return '0 Bytes'; | |
var k = 1024, | |
dm = decimals || 2, | |
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | |
i = Math.floor(Math.log(bytes) / Math.log(k)); | |
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; | |
} | |
// Usage: |
/** | |
* Gravity Wiz // Gravity Forms // Map GF Checkbox Field to ACF Checkbox Field | |
* http://graivtywiz.com/ | |
*/ | |
add_filter( 'gform_post_data', function( $data ) { | |
// Update "checkboxes" to your cusotm field name. | |
$data['post_custom_fields']['checkboxes'] = serialize( explode( ',', $data['post_custom_fields']['checkboxes'] ) ); | |
return $data; | |
} ); |
// Update PHPcs | |
sudo pear upgrade-all and sudo pear install PHP_CodeSniffer | |
// Check version of PHPcs | |
phpcs --version | |
// Go to Where coding standards available | |
/usr/local/pear/share/pear/PHP/CodeSniffer/Standards/WordPress-Coding-Standards |
// jQuery import | |
global.jQuery = require('jquery'); | |
var $ = global.jQuery; | |
window.$ = $; | |
// Bootstrap 4 depends on Popper.js | |
// Popper.js import | |
//import Popper from 'popper.js'; | |
//window.Popper = Popper; |