Skip to content

Instantly share code, notes, and snippets.

@leoken
Forked from jameskoster/functions.php
Created October 7, 2013 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leoken/6861132 to your computer and use it in GitHub Desktop.
Save leoken/6861132 to your computer and use it in GitHub Desktop.
<?php
/**
* Hook in on activation
*/
global $pagenow;
if ( is_admin() && isset( $_GET['activated'] ) && $pagenow == 'themes.php' ) add_action( 'init', 'yourtheme_woocommerce_image_dimensions', 1 );
/**
* Define image sizes
*/
function yourtheme_woocommerce_image_dimensions() {
$catalog = array(
'width' => '400', // px
'height' => '400', // px
'crop' => 1 // true
);
$single = array(
'width' => '600', // px
'height' => '600', // px
'crop' => 1 // true
);
$thumbnail = array(
'width' => '120', // px
'height' => '120', // px
'crop' => 0 // false
);
// Image sizes
update_option( 'shop_catalog_image_size', $catalog ); // Product category thumbs
update_option( 'shop_single_image_size', $single ); // Single product image
update_option( 'shop_thumbnail_image_size', $thumbnail ); // Image gallery thumbs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment