Skip to content

Instantly share code, notes, and snippets.

@BeardedGinger
Last active August 25, 2016 03:35
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 BeardedGinger/8ed8dafecd7aec406d66a67addf90b4d to your computer and use it in GitHub Desktop.
Save BeardedGinger/8ed8dafecd7aec406d66a67addf90b4d to your computer and use it in GitHub Desktop.
<?php
add_filter( 'wp_calculate_image_sizes', 'lc_content_archive_thumbnail_image_sizes', 10, 5 );
/**
* Change the default "sizes" attribute created by WordPress
* for the content archive thumbnails
*/
function lc_content_archive_thumbnail_image_sizes( $sizes, $size, $image_src, $image_meta, $attachment_id ) {
if( is_archive() && is_main_query() || is_home() ) {
$sizes = '(min-width: 769px) 150px, 100vw';
}
return $sizes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment