Skip to content

Instantly share code, notes, and snippets.

View mustardBees's full-sized avatar

Phil Wylie mustardBees

View GitHub Profile
@mustardBees
mustardBees / delete_products.sh
Created October 18, 2022 15:37
WooCommerce WP-CLI/WC-CLI script to delete all products.
#!/bin/bash
# Save script, run chmod +x on it, then...
# Usage: ./delete_products.sh [user_id]
ARGS="$@"
COUNT=$(wp wc product list --user=$1 --format=count)
BATCHES=$(bc <<< "$COUNT/100+1")
echo "Deleting $COUNT products in $BATCHES batches (via user ID $1)"
<div class="case-studies">
<div class="case-studies__item case-studies__item bg-accent-light">
<a href="#" class="case-studies__link">
<img src="one.png" class="case-studies__image" alt="">
<h1 class="text-xxl">One</h1>
</a>
</div>
<div class="case-studies__item">
<a href="#" class="case-studies__link">
<img src="two.png" class="case-studies__image" alt="">
.case-studies {
&__item {
&--featured {
}
}
&__link {
}
&__image {
@mustardBees
mustardBees / simple.html
Last active August 29, 2022 20:44
Simple BEM example
<style>
.list {}
.list__item {}
.list__item—-red {}
</style>
<ul class="list">
<li class="list__item">List item 1</li>
<li class="list__item list__item--red">List item 2</li>
<li class="list__item">List item 3</li>
@mustardBees
mustardBees / complex.html
Last active August 29, 2022 20:32
A little more complex BEM example
<style>
.case-studies {}
.case-studies__item {}
.case-studies__item--featured {}
.case-studies__link {}
.case-studies__image {} {}
</style>
<div class="case-studies">
<div class="case-studies__item case-studies__item--featured">
<?php $upgrading = time(); ?>
@mustardBees
mustardBees / distribute_user.sh
Last active August 26, 2022 13:33 — forked from dlh01/distribute_user.sh
WP-CLI: Add a user to all sites in a network
#!/bin/bash
# Save script, run chmod +x on it, then...
# Usage: ./distribute_user.sh [username] [role]
ARGS="$@"
echo "Adding user $1 as $2 to all sites"
SITES=$(wp site list --field=url --format=csv)
for site in $SITES
@mustardBees
mustardBees / index.php
Last active August 24, 2022 11:15
Here is a WordPress function to get Google reviews by place ID, which you can use as is or modify for your own website needs.
<?php
/**
* Get Google reviews by place ID.
*
* @param $google_place_id Google place ID.
*
* @return void
*/
function kanuka_get_google_reviews( $google_place_id ) {
/*
Theme Name: Kanuka Digital
Theme URI: https://www.kanukadigital.com/
Author: Kanuka Digital
Author URI: https://www.kanukadigital.com/
Description: Example child theme.
Version: 1.0.0
Template: parent-theme
*/
<?php
// Example meta box field
$cmb->add_field( array(
'name' => 'Test Select',
'id' => 'test_select',
'type' => 'pw_multiselect',
'options_cb' => 'iweb_get_cmb2_post_options',
'wp_query_args' => array(
'post_type' => 'page',
),