Get attachments but only from post gallery?

If you are referring to the shortcode, then you can use the get_post_gallery() or get_post_galleries() function to retrieve the gallery data such as ids (a list of IDs separated with comma) and src (an array of image URLs). Sample code #1: (using get_post_gallery()) 1234 is the ID of the post containing the shortcode. $galry = … Read more

ACF gallery hook?

You can use the same filter, just replace the type: add_filter(‘acf/update_value/type=gallery’, ‘my_acf_update_value’, 10, 3); All fields extend the same base class, so they also share the same basic filters.

Set default number of columns in gallery

You can override many of the Gallery Settings using the media_view_settings filter: /** /* Gallery Default Settings /* @param Array $settings /* @return Array $settings */ function theme_gallery_defaults( $settings ) { $settings[‘galleryDefaults’][‘columns’] = 5; return $settings; } add_filter( ‘media_view_settings’, ‘theme_gallery_defaults’ ); To change more settings, the easiest way is to use Developer Tools to inspect … Read more

GalleryView binding for WP Gallery, without NextGen

I’m afraid there’s no plugin, but using jQuery GalleryView is not that hard actually. Download Download jQuery GalleryView and put the css and js folders inside a new folder galleryview in your theme’s folder. Setting Up the List jQuery GalleryView needs an unordered list so we have to alter the gallery output: add_filter( ‘post_gallery’, ‘my_post_gallery’, … Read more

WordPress grab first image from gallery

I had the same issue and was previously using get_children() to retrieve the top 4 images from a gallery for a given page. Here’s the solution I came up with: // helper function to return first regex match function get_match( $regex, $content ) { preg_match($regex, $content, $matches); return $matches[1]; } // Extract the shortcode arguments … Read more

Add new images to top of existing gallery not bottom

Here’s a version of the linked solution that overrides galleryAddToolbar to have an extra button (insertTop) to do what you want (in your “functions.php”): add_filter( ‘media_view_strings’, function ( $strings, $post ) { $strings[‘addToGallery’] = __( ‘Add to end of gallery’ ); $strings[‘addToGalleryTop’] = __( ‘Add to start of gallery’ ); return $strings; }, 10, 2 … Read more

How To Put Multiple Image Galleries In A Single Post?

No, because galleries are defined as being all the images attached to a single Post. Therefore one Post cannot have multiple galleries because that goes against the definition of what a “gallery” is. Your method #3 will be as close as you can get, however you don’t have to use Pages specifically. You can use … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)