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 | |
add_filter( 'woocommerce_coupons_enabled', 'restofrais_coupons_enabled_checkout' ); | |
if( ! function_exists('restofrais_coupons_enabled_checkout')){ | |
function restofrais_coupons_enabled_checkout($coupons_enabled){ | |
$args = array( | |
'post_type' => 'shop_coupon', | |
'post_status' => 'publish', |
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
function filter_asp_results($results){ | |
$new_results = array(); | |
foreach($results as $result){ | |
if($result->post_type == 'artists'){ | |
$id = $result->id; | |
$tax = wc_attribute_taxonomy_name("artist"); | |
$x = get_term_by('name', $id, $tax); | |
$result->link = get_permalink( woocommerce_get_page_id( 'shop' ) ) . "?filter_artist=" . $x->term_id; | |
$new_results[] = $result; | |
} else { |
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 | |
/** | |
* Load the required css styles | |
* | |
* @since 2.0 | |
* @return void | |
*/ | |
public function add_frontend_styles() { | |
$min = ''; |
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 | |
global $_wp_additional_image_sizes; | |
print '<pre>'; | |
print_r( $_wp_additional_image_sizes ); | |
print '</pre>'; | |
?> |
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
// ------------------------------------------------------------ | |
// :: Convert bytes to human-friendly unit | |
// :: Source: http://php.net/manual/en/function.filesize.php#106569 | |
// ------------------------------------------------------------ | |
function human_filesize($bytes, $decimals = 2) { | |
$sz = 'BKMGTP'; | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor]; | |
} |
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 | |
// Add this to your function.php | |
function please_update_slug( $data, $postarr ) { | |
if($data['post_type'] == 'tribe_events') { | |
if ( !in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) { | |
$post_id = $postarr['ID']; | |
$value = $_POST["EventStartDate"]; | |
$date = new DateTime($value); | |
$data['post_name'] = sanitize_title( $data['post_title'] . '-' . $date->format('d-m-Y')); | |
} |