Skip to content

Instantly share code, notes, and snippets.

@cwulff
Forked from umidjons/wp-custom-image-size.php
Created January 20, 2014 20:02
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 cwulff/8527929 to your computer and use it in GitHub Desktop.
Save cwulff/8527929 to your computer and use it in GitHub Desktop.
<?php
// in functions.php
function my_theme_setup()
{
add_image_size('my-thumbnail', 310, 160);
}
add_action( 'after_theme_setup', 'my_theme_setup' );
?>
<?php
// in template file
the_post_thumbnail('my-thumbnail');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment