Instantly share code, notes, and snippets.

View new-project.txt
Install a new site to localhost.
cd to the themes directory and run:
\!h composer create-project roots/sage theme-name
Sage 9.0.5 should install, if not update to a version of PHP that Sage 9 needs and try again.
On Mac, you will be prompted to answer a few questions about the theme. Eventually you will be asked which framework you want to use, select option 0 to install no framework.
On Windows, you will need to cd to the new theme’s directory, and then run the following 3 commands, 1 at a time. Answer all the prompts to complete the Windows setup (
\!h ./vendor/bin/sage meta
\!h ./vendor/bin/sage config
\!h ./vendor/bin/sage preset
Again, select option 0 when asked which framework you want to use
View functions.php
function add_file_types_to_uploads($file_types){
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg+xml';
$file_types = array_merge($file_types, $new_filetypes );
return $file_types;
add_action('upload_mimes', 'add_file_types_to_uploads');
View contact.js
View contact.js
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('select');
var instances = M.FormSelect.init(elems);
View functions.php
add_filter('wpcf7_form_elements', function($content) {
$content = preg_replace('/<(span).*?class="\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^"]+)?\s*"[^\>]*>(.*)<\/\1>/i', '\2', $content);
return $content;
View common.js
// Animation
animSpeedMainView: 700, // Animation speed of mainviews: 0 - fastest
animSpeedSubView: 700, // Animation speed of subviews: 0 - fastest
animEffectMainView: 'easeInOutCubic', // Animation effect of mainviews change - jQuery (easing)
animEffectSubView: 'easeInOutCubic', // Animation effect of subviews change - jQuery (easing)
animEffectMainViewCss3: 'ease', // Animation effect of mainviews change - CSS3 (easing)
animEffectSubViewCss3: 'ease', // Animation effect of subviews change - CSS3 (easing)
// Steering
View header.blade.php
$args = array(
'post_type' => array(
View style.css
@media screen and (min-width:0\0) and (min-resolution:.001dpcm) {
.selector {
attribute: style;
View sort-products.php
<?php global $wp; ?>
<?php $shop_page_url = home_url( $wp->request ); ?>
on: 'hover'
var shopBase = '<?php echo $shop_page_url; ?>?orderby=';
View main.js
var positionName = $('#positionSelect option:selected').val();
var classOption = '.' + positionName;
if ( positionName == 'all') {
} else {
$('.all').not(classOption).fadeOut(500, function(){
setTimeout(function() {
}, 0);