Displaying a combination of Galleries

The built in shortcode doesn’t support that out of the box. However, it’s pretty easy to roll your own “multi-gallery” shortcode like so: <?php add_action( ‘init’, ‘wpse36779_add_shortcode’ ); /** * Adds the shortcode * * @ uses add_shortcode */ function wpse36779_add_shortcode() { add_shortcode( ‘multigallery’, ‘wpse36779_shortcode_cb’ ); } /** * The shortcode callback function * * … Read more

Add Download Button in prettyPhoto Plugin

Well programmers can make use of the prettyPhoto documentation and modify the plugin after the wp_footer() call in footer.php: Add the button via image_markup Give prettyPhoto a little height boost after adding the Download button. <?php wp_footer();?> <style>.download-btn{ margin-top: 10px; padding: 5px; background: #ccc; float: left }</style> <script> jQuery(document).ready(function() { jQuery(“a[rel^=’prettyPhoto’]”).prettyPhoto({ image_markup: ‘<img id=”fullResImage” src=”https://wordpress.stackexchange.com/questions/68012/{path}” … Read more

Large Media Library

I would not do it post by post I would use a plugin so I can manage it more and present them in lightbox or as a gallery. Plus in the future if you want to blog or add news you can always use the posts for that. Nextgen Gallery has been around for some … Read more

Fancybox not working. why?

oh and the images work, but they link to the image itself and that’s it. Are you sure the images are showing with their links? Your PHP code did not work with me, I had to use this instead: $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘post_mime_type’=>’image’, ‘posts_per_page’ => -1, ‘post_status’ => ‘any’, ‘post_parent’ => … Read more

In which version of WordPress was the new gallery shortcode implemented?

The file /wp-includes/media.php, where the Gallery Shortcode is defined, first appears in WordPress 2.5. It has the id (singular) attribute to refer to the post_parent: $attachments = get_children(“post_parent=$id … The ids (plural) attribute appears in WordPress 3.5, and is used to include attachments: if ( ! empty( $attr[‘ids’] ) ) { $attr[‘include’] = $attr[‘ids’]; } … Read more

WordPress show Gallery Title and Captions

get_post_gallery_images only returns a singular array of image URLs, so $image->post_title etc won’t work, hence your error message. The approach generally is off – you’ve followed the codex for get_post_gallery_images but that snippet is aimed at re-using the image urls within the post, but outside the gallery output. get_attached_media is more suited here (just a … Read more

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