I want to use the standard Wordpress gallery without using other plugins and stick to the gallery shortcode. So, I know I can change the size of the thumbnails, that are shown in the gallery grid with for example
[gallery size="xyz" link="file"].
But I am not satisfied with Wordpress opening the biggest file then, when clicking on one of the thumbnails and I would like to have stated a different size, which I have created upfront by using
add_image_size( 'galleryimage', 900, 900 ); in my child's functions.php, of course.
Here is the code I am using for generating the galleries on static pages:
<?php $people_attachments = new WP_Query( array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'posts_per_page' => 0, 'category_name' => 'people', // note: use category SLUG ) ); $people_id_array = array(); if ( $people_attachments->have_posts() ) : while ( $people_attachments->have_posts() ) : $people_attachments->the_post(); $people_id_array = get_the_ID(); endwhile; endif; // Important! wp_reset_postdata(); $people_ids = implode( ',', $people_id_array ); echo do_shortcode( '[gallery link="file" columns="5" order="DESC" orderby="ID" include="' . $people_ids . '"]' ); ?>
How do I add the target image size (size of linked image to be shown, when clicked)?