1

I am some difficulty working with the new galleries in WordPress 3.5. Here is a brief description of the problem we are having.

Project Details

Desktop and Mobile site generated from the same WP install

Currently using a modified version of swipe http://swipejs.com/ for a mobile slider that supports getting more post attachments with an offset

What we require

A way to embed the same gallery on multiple pages

Picture listing type gallery for Desktop site

Slider Gallery for mobile that support swiping, display one image at a time when swiped will get another image with ajax and display it

Problems

Wordress 3.5 no longer attaches images for galleries, cannot use get post attachments to get images used in gallery

Tried nextgen gallery but can't find a way to have more than 2 image sizes for a gallery, we would need a desktop thumbnail, the original image, and a mobile sized image

Any suggestions how to approach this problem?

Thanks!

Simalam
  • 359
  • 1
  • 8

2 Answers2

0

If you upload to a post it will still set that relation. There is a option to display 'images uploaded to this post' in the gallery. in the media manager. SO I don't know what you mean with:

cannot use get post attachments

What code are / where you using to display the gallery?

janw
  • 6,672
  • 6
  • 26
  • 45
  • 1
    In wordpress 3.5 the galleries are generated using [gallery ids="729,732,731,720"] If you select a image from your image gallery it is not attached to the post. I was using `$args = array( 'post_parent' => 283, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID', 'numberposts' => 2, 'offset' => 0 ); $spa_tour_images = get_children( $args );` – Simalam Jan 09 '13 at 21:39
0

Till 3.5 You could get all attachments images id with:

$attachments = get_children( array('post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );

where $post_id is an id of current post, $order and $order_by are standard query variables (ASC, menu_order in standard)

Then with images ID You can get them all using foreach and calling:

wp_get_attachment_link

to get a link to image, or to get completly html img code with alts, widths etc:

 wp_get_attachment_image

Should work well in 3.5, so You could upload all images to one post and use it as a placeholder for displaying entire gallery anywhere.

Marcin Bobowski
  • 1,745
  • 2
  • 19
  • 35
  • The problem with this method is if a user selects an existing image from the image gallery, it will not get attached to the post. When referencing the gallery by post id, only the images attached to that post will show. – Simalam Jan 10 '13 at 14:52