Skip to content

Instantly share code, notes, and snippets.

View dompl's full-sized avatar

Dom dompl

  • Red Frog Studio
  • United Kingdom
View GitHub Profile
@dompl
dompl / wp-query-ref.php
Last active August 31, 2021 11:31 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
$args = array(
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
wp user list --field=ID --role=customer | xargs wp user delete --yes
wp post list --field=ID --post_type=shop_order --posts_per_page=2000 | xargs wp post delete --force
wp post list --field=ID --post_type=products --posts_per_page=2000 | xargs wp post delete --force
wp post list --field=ID --post_type=posts --posts_per_page=2000 | xargs wp post delete --force
@dompl
dompl / woo-js-events.js
Last active October 22, 2023 06:12
WooCommerce - List of JS events
/*
* To find a complete list of all events (and stay updated on any new ones added)
* you can consult the .js files in the directory:
* /wp-content/plugins/woocommerce/assets/js/frontend
*/
// Woocommerce Checkout JS events
$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
@dompl
dompl / gc.txt
Created August 1, 2022 11:53
Global Coatings Keywords
Sand blasting
Grit blasting
Aluminium oxide blasting
Blasting to ISO8501
Painting to NORSOK M501
@dompl
dompl / wp_category_with_args.php
Created September 9, 2022 06:53
Get WordPress categories list with args
$categories = get_categories( [
'taxonomy' => 'category',
'type' => 'post',
'child_of' => 0,
'parent' => '',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'exclude' => '',
@dompl
dompl / banner.css
Last active October 27, 2022 07:03
Global Banner
#global-container{background-color:#000 !important;color:#fff;text-align:center;padding:1.5rem 0}#global-container .wrapper{max-width:95%;margin-left:auto;margin-right:auto}#global-container p{margin:0;font-size:.8rem}#global-container p:last-child{margin-top:10px;text-transform:uppercase}#global-container img{margin-bottom:20px}#global-container a{color:#fff;text-decoration:underline;font-weight:bold}#global-container a.tel{text-decoration:none}@media(min-width: 1024px){#global-container{text-align:left}#global-container .wrapper{display:flex;align-items:center;justify-content:space-between;max-width:100%}#global-container p{font-size:1rem;line-height:1.44rem}#global-container .left{margin-right:30px;margin-bottom:0}#global-container img{margin-bottom:0}}
@dompl
dompl / functions.php
Created December 8, 2022 11:37 — forked from eugenoprea/functions.php
Gravity Forms - Checkbox Dynamic Population
// When true, the form will be saved to DB after dynamic population
define('EO_SAVE_FORM_ON_PRE_RENDER', true);
// Adds a filter to form id 7. Replace 26 with your actual form id
add_filter('gform_pre_render_7', 'eo_populate_checkbox');
add_filter('gform_admin_pre_render_7', 'eo_populate_checkbox');
function eo_populate_checkbox($form) {
if (EO_SAVE_FORM_ON_PRE_RENDER)
@dompl
dompl / yar-addons.js
Last active October 23, 2023 09:26
New Yarn addons
// yarn add @rollup/plugin-multi-entry --dev
// yarn add gulp-modernizr --dev
// yarn add gulp-modernizr