Skip to content

Instantly share code, notes, and snippets.

View mikeyarce's full-sized avatar

Mikey Arce mikeyarce

View GitHub Profile
@mikeyarce
mikeyarce / storefront-homepage-product-categories.php
Created July 30, 2018 16:03
Storefront: change homepage product categories
<?php
// Hooking into the storefront_product_categories_args hook
add_filter( 'storefront_product_categories_args', 'marce_filter_homepage_product_categories_storefront', 11 );
// We're changing the values of limit, columns, and title for the Product Categories homepage section.
function marce_filter_homepage_product_categories_storefront( $args ) {
$args['limit'] = 1;
$args['columns'] = 4;
$args['title'] = 'Shop Categories';
@mikeyarce
mikeyarce / gallery-thumbnail.php
Created April 18, 2018 00:05
Override WooCommerce Gallery Thumbnail
@mikeyarce
mikeyarce / thumbnail-size.php
Created April 18, 2018 00:02
Override WooCommerce thumbnail image size
<?php
add_filter( 'woocommerce_get_image_size_thumbnail', function( $size ) {
return array(
'width' => 500,
'height' => 500,
'crop' => 1,
);
} );
@mikeyarce
mikeyarce / single-image.php
Created April 17, 2018 23:58
Set single image size
<?php
add_filter( 'woocommerce_get_image_size_single', function( $size ) {
return array(
'width' => 500,
'height' => 500,
'crop' => 1,
);
} );
@mikeyarce
mikeyarce / single-image.php
Created April 17, 2018 23:56
Override `woocommerce-single` image size
<?php
add_filter( 'woocommerce_get_image_size_single', function( $size ) {
return array(
'width' => 400,
'height' => '',
'crop' => 0,
);
} );
@mikeyarce
mikeyarce / storefront-image-sizes.php
Created April 17, 2018 23:49
Storefront image sizes
<?php
add_theme_support( 'woocommerce', apply_filters( 'storefront_woocommerce_args', array(
'single_image_width' => 416,
'thumbnail_image_width' => 324,
'product_grid' => array(
'default_columns' => 3,
'default_rows' => 4,
'min_columns' => 1,
'max_columns' => 6,
'min_rows' => 1
@mikeyarce
mikeyarce / seventeen.php
Created April 17, 2018 22:22
Twenty Seventeen WooCommerce images
<?php
add_theme_support( 'woocommerce', array(
'thumbnail_image_width' => 250,
'single_image_width' => 350,
) );
}
@mikeyarce
mikeyarce / non-relative-urls.php
Created March 26, 2018 20:00
Remove relative URLs for WooCommerce product images
<?php
/**
* Remove relative URLs for WooCommerce product images
*/
add_filter( 'woocommerce_product_get_image', function( $url, $product, $size, $attr, $placeholder, $image ) {
return $image;
}, 10, 6 );
@mikeyarce
mikeyarce / related.php
Created March 16, 2018 15:22
WooCommerce related-psosts template override for just showing one specific category of products
@mikeyarce
mikeyarce / marce_add_stripe_elements_styles.php
Last active January 31, 2018 22:14
Stripe custom elements styles
// Remove this top line if your file already has one
<?php
// Stripe provides a filter for you to add custom Stripe Elements Styling
// See full documentation from Stripe on what elements are available to be styled here:
// https://stripe.com/docs/stripe-js/reference#element-options
add_filter( 'wc_stripe_elements_styling', 'marce_add_stripe_elements_styles' );
function marce_add_stripe_elements_styles($array) {