$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>functions - How to use thumbnails in gallery?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

functions - How to use thumbnails in gallery?

matteradmin8PV0评论

Since Wordpress 5.x they've removed the thumbnail size option for galleries. Is there a way to activate or build a workaround? I like to build up a classic Lightbox gallery.

Since Wordpress 5.x they've removed the thumbnail size option for galleries. Is there a way to activate or build a workaround? I like to build up a classic Lightbox gallery.

Share Improve this question asked Feb 9, 2019 at 12:37 PetePete 1131 silver badge6 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 2

There is a project going on about the image sizes. You can follow it right here.

Right now, you can try using shortcode_atts_gallery filter. Take a look at these codes to get a hint:

/* Register shortcode_atts_gallery filter callback */
add_filter( 'shortcode_atts_gallery', 'meks_gallery_atts', 10, 3 );

/* Change attributes of wp gallery to modify image sizes for your needs */
function meks_gallery_atts( $output, $pairs, $atts ) {

/* You can use these sizes:
- thumbnail
- medium
- large
- full
or, if your theme/plugin generate additional custom sizes you can use them as well
*/

$output['size'] = 'medium'; //i.e. This will change all your gallery images to "medium" size

return $output;

}

You can find more information about shortcode_atts_gallery right here.

It's an ongoing process. Right now there is not a way to adjust manually the image sizes on the gallery block. It is being discussed by the WordPress core development community on this github issue.

Just because the default gutenberg gallery block does not allow you to do it does not mean you cannot install a 3rd party plugin, create a custom block yourself (I recommend using ACF Custom Blocks), or reverting to the classic editor for this specific use.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far