Skip to content

Instantly share code, notes, and snippets.

View digitalchild's full-sized avatar

Jamie Madden digitalchild

View GitHub Profile
@digitalchild
digitalchild / playwright.js
Created June 24, 2025 04:24
Playwright session persistance
const { chromium } = require('playwright');
async function createPersistentSession() {
// Create a persistent context (saves cookies, localStorage, etc.)
const context = await chromium.launchPersistentContext('./user-data', {
headless: false, // Set to true for production
viewport: { width: 1920, height: 1080 },
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
args: [
'--disable-blink-features=AutomationControlled',
@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 / 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
<?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 March 14, 2022 03:51
Add the vendor role to an instructor when they are approved.
<?php
/**
* Required Tutor LMS v.1.6.0
*/
add_action('tutor_new_instructor_after', 'wcv_add_vendor_role');
/**
* @param $instructor_id
*
@digitalchild
digitalchild / functions.php
Created February 9, 2022 04:01
Force product type, hide tabs and show only price field on WC Vendors Product Edit Standard form.
<?php
// Disable the product type drop down.
add_filter('wcv_disable_product_type', function() { return true; } );
add_filter( 'wcv_product_meta_tabs', function() { return array(); } );
// Adjust styles of the product tabs after removing them.
add_action('wp_head', 'wcv_add_custom_styles', 10);
function wcv_add_custom_styles() {
echo "<style>.tabs-nav { display: none!important;}</style>";
@digitalchild
digitalchild / functions.php
Created January 19, 2022 07:04
Disable the orders page on the WC Vendors Pro dashboard.
<?php
/**
* Disable existing order page hook into the dashboard links filter
*
* filter: wcv_pro_dashboard_urls
*/
add_filter( 'wcv_pro_dashboard_urls', 'wcv_remove_order_page' );
function wcv_remove_order_page( $pages ){
@digitalchild
digitalchild / functions.php
Created November 9, 2021 06:43
Add inventory fields to product-simple.php template for WC Vendors Pro
add_action( 'wcv_after_product_simple_after', 'wcv_add_inventory_fields' );
function wcv_add_inventory_fields( $object_id ){
?>
<!-- Inventory -->
<div class="wcv-product-inventory inventory_product_data tabs-content" id="inventory">
<?php WCVendors_Pro_Product_Form::manage_stock( $object_id ); ?>
<?php do_action( 'wcv_product_options_stock', $object_id ); ?>