Change the values of numberposts gallery

Use posts_per_page instead of numberposts So the $args for the get_posts would be like below and also the param for post_status is wrong. Check the codex for the details here Also when when you are fetching one attachment it is useless to set a counter for it. You can use the modified function function get_random_gallery_images(){ … Read more

Moved blog – galleries don’t work

Gallery can include either: specific images, in which case their IDs are explicitly listed in shortcode all images attached to the post, in which case shortcode doesn’t specify that (as in your example) So your description is a little contradictory – if images weren’t attached to the post, then that example wouldn’t have worked in … Read more

gallery image size

As an alternative to removing the image sizes (which digging a little deeper looks very complicated), why not change the size of the images in your gallery? If you use a larger image they will “fill the space” at larger screens and then shrink down for smaller screens. The Gallery shortcode has a size parameter … Read more

Add anchor tag on previous_image_link / next_image_link

i’m usig the code for create a link (next and prev) $attachments = array_values( get_children( array( ‘post_parent’ => $post->post_parent, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ID’ ) ) ); foreach ( $attachments as $k => $attachment ) : if ( $attachment->ID == $post->ID ) break; endforeach; … Read more

Options for an SEO gallery?

I believe your issue is that you’ve checked this box in the media settings: Every image uploaded afterwards had it’s thumbnail cropped to fit those proportions. Unchecking the box will fix this for new uploaded images but your existing photos will still be cropped. You can however regenerate the image thumbnails using the new settings. … Read more