Skip to content

Instantly share code, notes, and snippets.

View gerrgg's full-sized avatar
💯

Greg Bastianelli gerrgg

💯
View GitHub Profile
@gerrgg
gerrgg / wpo_wcpdf_add_meta_data_to_invoice.php
Last active May 21, 2020 13:45
How to include custom meta data and custom fields to Woocommerce-pdf-invoices-packing-slips plugin.
<?php
// hooks into invoice.php
add_action( 'wpo_wcpdf_after_order_data', 'msp_add_meta_data_to_wpo_invoice', 100, 2 );
function msp_add_meta_data_to_wpo_invoice( $type, $order ){
/**
* Adds custom meta data to WPO generated invoice plugin
* DOC: https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/pdf-template-action-hooks/
* @param string $template_type
@gerrgg
gerrgg / sync_portwest
Last active October 1, 2019 11:20
Downloads the portwest stock on hand CSV, compares items matching on sku and updates accordingly.
#!/bin/bash
# Gregory Bastianelli
# http://gerrg.com/resume
# 30-09-2019
# Could pass a number of flags to quickly loop through and update any field (db column)
# download file
FILENAME='./sohUS.csv'
curl -o "${FILENAME}" http://www.portwest.us/downloads/sohUS.csv
@gerrgg
gerrgg / wp_remove_vs_from_content.sh
Last active September 26, 2019 21:50
How to remove Visual Composer Shortcodes from Wordpress content. Bash script which strips WP Bakery shortcodes from wordpress content.
# Greg Bastianelli
# 26-09-1994
# Requires WP-CLI
# Regex's from https://gist.github.com/gemmadlou/7a0189bfae6c2c7268de12f1de822b8a
# Uses an array of regex specifically designed to trim off all wp-bakery visual-studio from your wordpress content.
declare -a arr=("\[/vc(.*?)\]" "\[vc(.*?)\]" "\[custom_font(.*?)\]" "\[/custom_font(.*?)\]" "\[/vc_column_text(.*?)\]" "\[vc_separator(.*?)\]" "\[/vc_column(.*?)\]" "\[vc_row(.*?)\]" "\[portfolio_list(.*?)\]");
for i in "${arr[@]}"
do