Skip to content

Instantly share code, notes, and snippets.

View cklosowski's full-sized avatar

Chris Klosowski cklosowski

View GitHub Profile
@cklosowski
cklosowski / woocommerce-fees-by-state.php
Created August 5, 2015 06:09
Add fees to the WooCommerce cart, based on the state chosen for shipping
<?php
/**
* Plugin Name: WooCommerce - Fees by State
* Plugin URI: https://filament-studios.com/
* Description: Add Fees to the cart based off the shipping state
* Version: 1.0
* Author: Filament Studios
* Author URI: https://filament-studios.com
* License: GPL-2.0+
*/
@cklosowski
cklosowski / eddwp-custom-session-start.php
Created May 31, 2019 23:58
Selectivly start Sessions with Easy Digital Downloads
<?php
/**
* If the page loaded is the homepage, we don't need to start a session if one doesn't exist
*/
function eddwp_ck_maybe_start_session( $start_session ) {
// Doesn't start sessions on the homepage.
if ( '/' == $_SERVER['REQUEST_URI'] ) {
$start_session = false;
@cklosowski
cklosowski / woocommerce-hide-empty-categores.php
Created March 25, 2017 15:34
Here's a quick function that will look at the categories in the product list, find the products in the category, and if none of the products are visible, it will not display the category in the widget: https://chrisk.io/woocommerce-hide-categories-with-no-visible-products-in-the-product-category-widget/
<?php
/**
Plugin Name: WooCommerce - Exclude empty categories from widget
Plugin URI: https://chrisk.io/woocommerce-hide-categories-with-no-visible-products-in-the-product-category-widget/
Description: Excludes categories with no visible products from the WooCommerce category list
Version: 0.1
Author: Chris Klosowski
Author URI: https://chrisk.io
*/
<?php
/**
* Plugin Name: chrisk.io - Example WP-CLI Progress Bar
* Plugin URI: https://chrisk.io/adding-progress-bars-wp-cli-processes/
* Description: An example plugin for creating progress bars in your WP-CLI processes.
* Version: 1.0
* Author: Chris Klosowski
* Author URI: https://chrisk.io
* License: GPL-2.0+
*/
@cklosowski
cklosowski / edd-sl-custom-local-domains.php
Created January 25, 2018 19:55
Add TLDs and Subdomains to Software Licensing is_local_url checks.
<?php
// Example of adding a TLD (.org in this example) to the is_local_url check.
function ck_add_url_tlds( $tlds_to_check ) {
$tlds_to_check[] = '.org';
return $tlds_to_check;
}
add_filter( 'edd_sl_url_tlds', 'ck_add_url_tlds', 10, 1 );

Keybase proof

I hereby claim:

  • I am cklosowski on github.
  • I am cklosowski (https://keybase.io/cklosowski) on keybase.
  • I have a public key ASCOP7reanfM8vuURtRSisGC-Fn16yydrouHAkSF1psdVwo

To claim this, I am signing this object:

@cklosowski
cklosowski / edd-2.9.4-templatable-changes.txt
Last active July 9, 2018 18:37
A list of changes for the Easy Digital Downloads 2.9.4 release that add nonce verification to some actions. The format lists the file, a function (if relevant), what changes were made, and then the previous version of code, and the new version of the code.
/**
*
* Templates Changed
*
* These files are part of the Easy Digital Downlaods template structure. If you've added custom template files to your theme, for any of the following files, you will need to be sure the changes
* are added to your custom templates in order to avoid any unexpected behavior.
*
*/

Keybase proof

I hereby claim:

  • I am cklosowski on github.
  • I am cklosowski (https://keybase.io/cklosowski) on keybase.
  • I have a public key ASAOloI2X1e3X9gnhxhRaQKn83WoFGGXbn8FFIrHFJFoqAo

To claim this, I am signing this object:

<?php
/**
* This is a rollbot for earn.gg written in PHP
*
* It will use the parameters below to run bets. If a bet wins it resets to the $starting value.
* If a bet loses, it doubles your bet amount and continues to do so until you win, or hit the $max_bet.
*
* Once you win, it kicks back down to the $starting bet.
*
@cklosowski
cklosowski / edd-rial-to-toman.php
Created July 27, 2017 21:34
EDD 2.8 - Rial > Toman purchase link fix
<?php
if ( ! function_exists( 'edd_toman_currency_symbol' ) ) {
function edd_toman_currency_symbol( $symbol, $currency ) {
if ( ! is_admin() && 'rial' === strtolower( $currency ) ) {
return 'تومان';
}
return 'ریال';
}
}
add_filter( 'edd_currency_symbol', 'edd_toman_currency_symbol', 10, 3 );