Skip to content

Instantly share code, notes, and snippets.

<?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
<?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' );
<?php
/*
* Plugin Name: Remove crazy counts slowing down my dashboard
* Plugin URI: https://pmgarman.me
* Description: Those comment counts are such a pain when you have a lot of comments
* Author: Patrick Garman
* Author URI: https://pmgarman.me
* Version: 1.0.0
* License: GPLv2
*/
@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
*/