Skip to content

Instantly share code, notes, and snippets.

View digitalchild's full-sized avatar

Jamie Madden digitalchild

View GitHub Profile
@digitalchild
digitalchild / functions.php
Created April 23, 2021 04:32
Add Theme support for Woocommerce Product gallery Lightbox, zoom and slider
<?php // Do not include this if already open! Code goes in theme functions.php.
add_action( 'after_setup_theme', 'add_wc_gallery_lightbox', 100 );
function add_wc_gallery_lightbox() {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
@digitalchild
digitalchild / functions.php
Last active November 28, 2023 15:13
Fix for no orders found WooCommerce
<?php
// Found https://core.trac.wordpress.org/ticket/45719
function fix_request_query_args_for_woocommerce( $query_args ) {
if ( isset( $query_args['post_status'] ) && empty( $query_args['post_status'] ) ) {
unset( $query_args['post_status'] );
}
return $query_args;
}
add_filter( 'request', 'fix_request_query_args_for_woocommerce', 1, 1 );
@digitalchild
digitalchild / gist:f012dd4a733ad7cf7e9f5c098bee9505
Created November 14, 2023 07:43
German Subtitles "What kind of WordPress theme do I have: classic, block, or something else?
Github Issue: https://github.com/WordPress/Learn/issues/1873
Prompt:
I need your help with translation from english to german. I have the english translation and the german translation. Would you be able to tell me if the german translation is correct?
Response:
Absolutely, I'd be happy to help with that. Please provide both the English text and the German translation, and I'll review the German version for accuracy and correctness.
# Setup for the Automating WordPress with no code commands
# Install npm
npm install -g npm@latest
# Install n8n with npm
npm install n8n -g
# Fix Authorization 401 for n8n and localwp WooCommerce REST API
# https://www.schakko.de/2020/09/05/fixing-http-401-unauthorized-when-calling-woocommerces-rest-api/
@digitalchild
digitalchild / functions.php
Last active May 13, 2023 01:35
Add 16% VAT to vendors commission.
<?php
// Add 16% VAT to vendor commission
add_filter( 'wcv_commission_rate', 'my_wcv_commission_rate', 10, 5 );
function my_wcv_commission_rate( $commission, $product_id, $product_price, $order, $qty ) {
$vat_fee = 0.16;
$marketplace_split = $product_price - $commission;
$vat = $marketplace_split * $vat_fee;
$commission -= $vat;
@digitalchild
digitalchild / MchIPUtils.php
Created February 11, 2023 03:24
Updated MchIPUtils file to support PHP8.0 for Invisible recaptcha plugin https://wordpress.org/plugins/invisible-recaptcha/
<?php
/**
* Copyright (c) 2016 Ultra Community (http://www.ultracommunity.com)
*
* Replace this file in invisible-recaptcha/includes/utils/MchIPUtils.php
*/
namespace InvisibleReCaptcha\MchLib\Utils;
final class MchIPUtils
@digitalchild
digitalchild / functions.php
Last active March 3, 2023 04:35
Add custom link to pro dashboard navigation
<?php
// Add this to your themes function.php change the values to suit where you want the link to go.
// slug needs to be a complete URL.
function custom_menu_link( $pages ) {
$pages[ 'custom_link' ] = array(
'slug' => 'http://yoursite.com/customlink/here',
'label' => __('Custom Link', 'wcvendors-pro' ),
<?php
function change_billing_fields( $fields ){
$fields['billing_postcode']['label'] = '';
$fields['billing_postcode']['placeholder'] = 'Postcode monkey*';
$fields['billing_email']['label'] = '';
$fields['billing_email']['placeholder'] = 'Email*';
$fields['billing_phone']['label'] = '';
$fields['billing_phone']['placeholder'] = 'Phone*';
return $fields;
@digitalchild
digitalchild / asset.js
Created February 1, 2023 05:29
Multiple file Gist Example
var somejsfile;
@digitalchild
digitalchild / functions.php
Created May 6, 2016 14:50
Service drop down
<?php
WCVendors_Pro_Form_Helper::select2( array(
'post_id' => $object_id,
'id' => 'service[]',
'label' => __( 'Service Type', 'wc_simple_hosts' ),
'wrapper_start' => '<div class=”all-100″>',
'wrapper_end' => '</div>',
'taxonomy' => 'pa_service',
'taxonomy_args' => array( 'hide_empty'=>false ),