Skip to content

Instantly share code, notes, and snippets.

View DustinHartzler's full-sized avatar

Dustin Hartzler DustinHartzler

View GitHub Profile
@DustinHartzler
DustinHartzler / functions.php
Created May 27, 2016 07:11
Limit postal codes to 5 digits
add_filter( 'woocommerce_default_address_fields' , 'custom_override_default_address_fields' );
// Our hooked in function - $address_fields is passed via the filter!
function custom_override_default_address_fields( $address_fields ) {
$address_fields['postcode']['maxlength'] = 5;
return $address_fields;
}
dd.variation-VehicleAge p,
dd.variation-CurrentMileage p,
dd.variation-Region p
{
display: none;
}
dt.variation-Region, dt.variation-VehicleType, dt.variation-VehicleAge, dt.variation-CurrentMileage, dt.variation-Reg, dt.variation-Make, dt.variation-Model, dt.variation-PolicyStartDate {
display: none;
}
function customise_product_brand_slug ( $tax ) {
$tax['rewrite']['slug'] = 'manufacturers';
$tax['labels']['name'] = 'Manufacturers';
return $tax;
}
add_filter( 'register_taxonomy_product_brand', 'customise_product_brand_slug' );
function my_wc_custom_shipping_fields( $fields ) {
$fields['shipping_postcode']['maxlength'] = 5;
return $fields;
}
add_filter( 'woocommerce_shipping_fields', 'my_wc_custom_shipping_fields' );
function my_wc_custom_billing_fields( $fields ) {
$fields['billing_postcode']['maxlength'] = 5;
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 15 );
<header class="archive-header">
<h1 class="fl"><?php single_cat_title( '', true ); ?></h1>
</header>
<header class="archive-header">
<h1 class="fl"><?php _e( 'Archive', 'woothemes' ); ?> | <?php single_cat_title( '', true ); ?></h1>
<span class="fr archive-rss"><?php $cat_id = get_cat_ID( single_cat_title( '', false ) ); echo '<a href="' . get_category_feed_link( $cat_id, '' ) . '">' . __( 'RSS feed for this section', 'woothemes' ) . '</a>'; ?></span>
</header>
@DustinHartzler
DustinHartzler / functions.php
Created March 23, 2016 13:18
Remove SKU column
add_filter( 'wc_pip_document_table_headers', 'sv_wc_pip_document_unset_sku', 200, 1 );
add_filter( 'wc_pip_document_table_row_item_data', 'sv_wc_pip_document_unset_sku', 200, 1 );
function sv_wc_pip_document_unset_sku( $row ) {
unset( $row['sku'] );
return $row;
}
function cs_wc_product_type_options( $product_type_options ) {
$product_type_options['virtual']['default'] = 'yes';
$product_type_options['downloadable']['default'] = 'yes';
return $product_type_options;
}
add_filter( 'product_type_options', 'cs_wc_product_type_options' );