Created
November 16, 2015 17:45
-
-
Save RadGH/03a03b95d7d4aa919ed7 to your computer and use it in GitHub Desktop.
define & use custom image sizes
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 | |
// $src = wp_get_attachment_image_src( $attachment_id, 'store-archive' ); | |
// $src[0] = "http://.../uploads/my_image-240x350.jpg" | |
// $src[1] = 240 | |
// $src[2] = 350 | |
add_action( 'after_setup_theme', 'ld_theme_image_sizes' ); | |
function ld_theme_image_sizes() { | |
// archive pages | |
add_image_size( 'store-archive', 240, 350, 1 ); | |
// single product pages, the main image | |
add_image_size( 'store-singular', 520, 700, 1 ); | |
// single product pages, the thumbnails used below the main image | |
add_image_size( 'store-gallery-thumb', 100, 150, 1 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment