Skip to content

Instantly share code, notes, and snippets.

View tradesouthwest's full-sized avatar
Working remotely

Larry tradesouthwest

Working remotely
View GitHub Profile
@tradesouthwest
tradesouthwest / coloradocookiecompany-statreport
Created January 2, 2024 14:49
wordpress.org/support/topic/wc-shipping-zones-missing/#post-17311865
`
### WordPress Environment ###
WordPress address (URL): http://thecoloradocookiecompany.com/stage1223
Site address (URL): http://thecoloradocookiecompany.com/stage1223
WC Version: 8.4.0
REST API Version: ✔ 8.4.0
WC Blocks Version: ✔ 11.6.2
Action Scheduler Version: ✔ 3.7.0
Log Directory Writable: ✔
@tradesouthwest
tradesouthwest / html-admin-page-shipping-zones-support-coloradocookiecompany.txt
Created December 30, 2023 17:16
html-admin-page-shipping-zones-support-coloradocookiecompany table body tag blank
`
### WordPress Environment ###
WordPress address (URL): http://thecoloradocookiecompany.com/stage1223
Site address (URL): http://thecoloradocookiecompany.com/stage1223
WC Version: 8.4.0
REST API Version: ✔ 8.4.0
WC Blocks Version: ✔ 11.6.2
Action Scheduler Version: ✔ 3.7.0
Log Directory Writable: ✔
@tradesouthwest
tradesouthwest / image-list.php
Created November 12, 2021 17:56
list images with tow files drop into img folder
<?php
/**
* TSW Listing Nano Directory
* Author: Larry Judd Oliver @tradesouthwest | http://tradesouthwest.com
* Contributors in readme.md file
* License in LICENSE.md file
* /////////////////////////////////////////////////////////////////////
* MUST BE USED ALONG WITH [list-images.php]
* \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
*/
@tradesouthwest
tradesouthwest / check-for-product-category-woocommerce.php
Created December 1, 2020 20:41
Check if single product has a specific product category.
<?php
// checking terms since wc_product are not post terms
function product_cat_contingencies()
{
global $post;
// get the product category term objects
$terms = wp_get_post_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ) $categories[] = $term->slug;
if( in_array('custom-tarps', $categories) ) {
return true;
@tradesouthwest
tradesouthwest / wp-session-display-cookies.php
Created August 21, 2020 17:41
Get all raw session meta from all wordpress users.
<?php
/**
* Get all raw session meta from all users
*
* @return array
*/
function readlimit_get_all_sessions_raw() {
global $wpdb;
$results = array();
@tradesouthwest
tradesouthwest / ada-woocommerce-store-notice.php
Last active September 20, 2021 05:28
Script to add ADA compliant links WordPress Woocommerce + change Checkout message text
/**
* Script to add ADA compliant links
* .woocommerce-store-notice__dismiss-link andd all buttons, some with icons class
* @uses wp_footer()
*/
function ibsen_child_hook_javascript_footer()
{
?>
<script id="isben-add-ntccnt" type="text/javascript">
@tradesouthwest
tradesouthwest / yith-request-quote-view-attributes.php
Last active June 30, 2020 01:51
yith request a quote view to get attribute values into quote table aka woocomerce cart
<?php
/**
* Get product attributes to display on yith-quote table
* @param string $attribute_name Taxonomy name
* @param string $product_id Global value
* @return array Attribute value
*/
function betheme_child_get_product_terms_carton( $attribute_name, $product_id )
{
@tradesouthwest
tradesouthwest / woo-category-catalog-check.php
Last active June 24, 2020 22:53
Only display YITH Request A Quote button on Woo pages. Parent child relations. Woocommerce
<?php
/**
* Only display YITH Request A Quote button on Woo pages.
* @uses Shortcode from YITH
* Maybe translate manually. && $post->post_parent > 0
* @see https://developer.wordpress.org/reference/functions/is_page/
*/
function betheme_child_request_aquote_echo( )
{
if ( is_home() || is_front_page() || is_page( array(
@tradesouthwest
tradesouthwest / tsw-defer-reg.php
Created June 18, 2020 17:52
Defer loading of external javascripts, like google ads [wordpress]
<?php
/**
* Defer loading javascript for unregistered scripts (ads)
* @uses $tag(string) The <script> tag for the enqueued script.
* @uses $handle(string) The script's registered handle.
* @uses $src(string) The script's source URL.
* @see https://developer.wordpress.org/reference/hooks/script_loader_tag/
*/
/*function to add async and defer attributes*/
function colormag_child_add_defer_jstags( $tag, $handle ){
@tradesouthwest
tradesouthwest / script-tags-and-defer-tests.php
Last active June 18, 2020 16:42
wp get registered script tags and display at top of website page
<?php
/*
* Getting registered script tags and display at top of website page for dev only.
* Thanks http://wordpress.stackexchange.com/questions/54064/how-do-i-get-the-handle-for-all-enqueued-scripts
*/
add_action( 'wp_print_scripts', 'wsds_detect_enqueued_scripts' );
function wsds_detect_enqueued_scripts() {
global $wp_scripts;
foreach( $wp_scripts->queue as $handle ) :
echo $handle . ' | ';