Home › Forums › Add-ons › Gallery Field › Gallery medium-large dimensions › Reply To: Gallery medium-large dimensions
You can specify the dimension of any thumbnails by adding a filter to your function.php:
if ( !function_exists('theme_setup') ) :
function theme_setup() {
// Add post thumbnails (http://codex.wordpress.org/Post_Thumbnails)
add_theme_support('post-thumbnails');
add_image_size( 'one-thumb-slider', 1170, 430, true );
add_image_size( 'two-thumb-full', 900, 500, true );
add_filter( 'image_size_names_choose', 'custom_image_sizes' );
}
endif;
add_action('after_setup_theme', 'theme_setup');
Then in your loop:
<img src="<?php echo $image['sizes']['two-thumb-full']; ?>" alt="<?php echo $image['alt']; ?>" />
Note: Remember to add the filter before uploading any images otherwise you need to reset all the thumbs via a plugin or delete and re-upload all the images.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.