Skip to content

Instantly share code, notes, and snippets.

<?php
function pmgarman_custom_wc_thankyou_action( $order_id = 0 ) { ?>
<script>
var leadNumber = '<?php echo $order_id; ?>';
</script>
<?php }
add_action( 'woocommerce_thankyou', 'pmgarman_custom_wc_thankyou_action' );
@pmgarman
pmgarman / gist:1886509
Created February 22, 2012 18:29
WooCommerce Product Tabs
add_action('woocommerce_product_tabs','tab_name');
add_action('woocommerce_product_tab_panels','tab_panel');
function tab_name() {
echo '<li><a href="#tab-name">Tab Name</a></li>';
}
function tab_panel() {
echo '<div class="panel" id="tab-name">';
echo '<h2>This is a cool tab</h2>';
@pmgarman
pmgarman / gist:1901421
Created February 24, 2012 14:51
add_actions
add_action('woocommerce_before_single_product_summary','stuff_before_summary');
add_action('woocommerce_after_single_product_summary','stuff_after_summary');
function stuff_before_summary() {
echo '<div class="class">';
}
function stuff_after_summary() {
echo '</div>';
}
@pmgarman
pmgarman / gist:5876865
Created June 27, 2013 14:27
Sample .my.cnf file for Linux users
[client]
user = username
password = password
@pmgarman
pmgarman / change-git-app-auths.sh
Created July 19, 2013 09:55
remove repo access from NinjaPanel authorizations
// Both requests will ask your password, you know what to do.
// First list all your github authorizations, you will see everything you've authorized what you need is the ID of the app named "WooNinja Panel" - then run the second command after entering the authorization ID
curl https://api.github.com/authorizations -u YOURGITHUBUSERNAME
curl --request PATCH -d '{"remove_scopes":["repo"]}' https://api.github.com/authorizations/THEIDOFTHEAUTHORIZATION -u YOURGITHUBUSERNAME
@pmgarman
pmgarman / install-puppet-agent.sh
Created July 28, 2013 15:43
Install Puppet agent on Ubuntu 12.04 Precise Pangolin
wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb
dpkg -i puppetlabs-release-precise.deb
apt-get update
apt-get install puppet
puppet resource service puppet ensure=running enable=true
@pmgarman
pmgarman / site.pp
Created July 30, 2013 17:35
Puppet > Nginx > Ghost Proxy
class do-stuff {
include apt
include nginx
exec { 'first update':
command => '/usr/bin/apt-get update'
}
apt::ppa { 'ppa:chris-lea/node.js':
require => Exec['first update'],
@pmgarman
pmgarman / imagerows
Created August 8, 2013 18:48
Example image rows shortcodes creating three rows of images.
[imagerow images="http://pmgarman.me/wp-content/uploads/2013/08/DSCN1989-1024x768.jpg"]
[imagerow images="http://pmgarman.me/wp-content/uploads/2013/08/DSCN2052-1024x768.jpg,http://pmgarman.me/wp-content/uploads/2013/08/DSCN2018-1024x768.jpg,http://pmgarman.me/wp-content/uploads/2013/08/DSCN2041-1024x768.jpg"]
[imagerow images="http://pmgarman.me/wp-content/uploads/2013/08/DSCN2022-1024x768.jpg,http://pmgarman.me/wp-content/uploads/2013/08/DSCN1874-1024x768.jpg"]
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public
@pmgarman
pmgarman / flashsale.php
Created March 15, 2019 16:02
Old code for WC 2.x to set a flash sale price on all products.
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Check if WP_CLI exists, and only extend it if it does
if ( defined( 'WP_CLI' ) && WP_CLI && ! class_exists( 'CP_CLI' ) ) {
/**
* Class CP_CLI
*/