Tag Info

Hot answers tagged


Here are three methods Approach #1 It's common to wrap the output with custom HTML. We can do that by using the post_gallery filter and the gallery_shortcode() callback: /** * HTML Wrapper - Support for a custom class attribute in the native gallery shortcode */ add_filter( 'post_gallery', function( $html, $attr, $instance ) { if( isset( ...


All those complex functions can be reduced to one simple function: attachment_url_to_postid() You only need to parse the image URL to retrieve the attachment ID: $attachment_id = attachment_url_to_postid( $image_url ); echo $attachment_id; That's all you need.


As of 2015 and NextGen 2.0. Don't hack this, use shortcodes to display a single image and then lead to the lightbox: [ngg_images gallery_ids=7 display_type=photocrati-nextgen_basic_thumbnails disable_pagination=1 images_per_page=1 show_all_in_lightbox=1 show_slideshow_link=0] Further documentation and useful examples.


WordPress doesn't make it very easy to modify aspects of the gallery shortcode. Some attributions: Thanks to user peterbra for really putting the whole thing together a year ago. Thanks to user birgire for coming up with a solution as far as adding the attribute in a meaningful way. The other option besides birgires ( as far as I know ) is to pretty ...


I'm used to deal with ACF configurations and I think that the solution to your problem is quite simple, and is integrated in the ACF "gallery" field configuration options. Check out this link, where you will find described all the options for a "gallery" field. As you will see, there's a parameter "minimum selection" which description is: The minimum ...

Only top voted, non community-wiki answers of a minimum length are eligible