This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function micemade_wpcli_delete_before( $args, $assoc_args ) { | |
// If arguments array is empty, or if there aren't exactly 5 items, show error notice. | |
if ( empty( $args ) || count( $args ) !== 5 ) { | |
WP_CLI::error( __( 'Parameters: POST TYPE, POST STATUS, YEAR, MONTH and DAY are required (in this exact order). Please check your parameters. Command syntax is: wp delete-before <post_type> <post_status> <year> <month> <day> < --number=100 > < --date=post_date >.', 'micemade-fse-store' ) ); | |
return; | |
} | |
$post_type = $args[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Woocommerce cart - display prices with coupons applied, per cart item. | |
* | |
* @param string $subtotal | |
* @param array $cart_item | |
* @param string $cart_item_key | |
* @return $subtotal | |
* | |
* Inspired by: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Un-assign "Used for variations" from product attribute | |
* if the "pa_size" attribute is "Universal size" | |
* because of possible multiple version of universal sizes, | |
* we search the attribute which slug starts with a "uni" | |
*/ | |
function unassign_variation_to_attribute() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change priority of hooked functions in "content-product.php" | |
* | |
* @return void | |
*/ | |
function wc_content_product_priorities() { | |
global $wp_filter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin (WooCommerce) loads first | |
* | |
* @return void | |
* make sure plugin (WooCommerce) is loaded before any other, | |
* this was created because of hook priority issues. | |
*/ | |
function prefix_load_plugin_first() { | |
// Get all active plugins from options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* FILTER WIDGETS IN WP ADMIN | |
* assuming you already enqueued some of your js / css in WP admin ( customAdminCode() ) : | |
* include (or separately enqueue) this jQuery plugin - https://github.com/cheeaun/jquery.livefilter | |
* all code (php,js,css) is here, but you should separate it, off course ... ;) | |
*/ | |
function customAdminCode() { | |
wp_register_script('my-admin-js', get_template_directory_uri(). '/js/admin/admin.js'); |