2 Fixed code formatting, removed 3.5 noise to make it more "modern"
source | link

Wordpress 3.5 grab first image from gallery

I'm noticing that adding a gallery to a page now just lists the ID's of images, slightly different to before, and reordering the images just amends the order of the ID's listed in theThe WordPress gallery short-code.

So this...

[gallery order="DESC" link="file" columns="4"]

It'sshortcode now looks like this...:

[gallery ids="3439,3440,3444,3443,3445,3453,3457,3458,3456,3461,3452,3468,3467,3470,3464,3459,3463,3462,3460,3466,3454,3450,3449,3448,3451,3447,3446,3442,3441,3438,3471,3469"]3468"]

Which is fine, and old galleries created in previous versions still appear to work. MyMy problem is I have a summary page grabbing the first image of every child page. The code is something like this....:

                                                     $args       $args = array(
                                                        'post_type'    'post_type' => 'attachment',
                                                          'post_parent'  'post_parent' => $page->ID,
                                                      'orderby'      'orderby' => 'menu_order ID',
                                                   'order'         'order'=>=> 'asc',
                                                         'numberposts'   'numberposts' => 1,
                                                            );
                                                        $attachments = get_posts( $args ); 

This now doesn't work (I'm guessing because gallery order is now based on the ID's) Any way to fix it? Thanks

Wordpress 3.5 grab first image from gallery

I'm noticing that adding a gallery to a page now just lists the ID's of images, slightly different to before, and reordering the images just amends the order of the ID's listed in the gallery short-code.

So this...

[gallery order="DESC" link="file" columns="4"]

It's now this...

[gallery ids="3439,3440,3444,3443,3445,3453,3457,3458,3456,3461,3452,3468,3467,3470,3464,3459,3463,3462,3460,3466,3454,3450,3449,3448,3451,3447,3446,3442,3441,3438,3471,3469"]

Which is fine, and old galleries created in previous versions still appear to work. My problem is I have a summary page grabbing the first image of every child page. The code is something like this....

                                                            $args = array(
                                                            'post_type' => 'attachment',
                                                            'post_parent' => $page->ID,
                                                            'orderby' => 'menu_order ID',
                                                            'order'=> 'asc',
                                                            'numberposts' => 1,
                                                            );
                                                        $attachments = get_posts($args);

This now doesn't work (I'm guessing because gallery order is now based on the ID's) Any way to fix it? Thanks

Wordpress grab first image from gallery

The WordPress gallery shortcode now looks like this:

[gallery ids="3439,3440,3444,3443,3445,3453,3457,3458,3456,3461,3452,3468"]

My problem is I have a summary page grabbing the first image of every child page. The code is something like this:

$args        = array(
    'post_type'     => 'attachment',
    'post_parent'   => $page->ID,
    'orderby'       => 'menu_order ID',
    'order'         => 'asc',
    'numberposts'   => 1,
);
$attachments = get_posts( $args ); 

This now doesn't work (I'm guessing because gallery order is now based on the ID's) Any way to fix it?

1
source | link

Wordpress 3.5 grab first image from gallery

I'm noticing that adding a gallery to a page now just lists the ID's of images, slightly different to before, and reordering the images just amends the order of the ID's listed in the gallery short-code.

So this...

[gallery order="DESC" link="file" columns="4"]

It's now this...

[gallery ids="3439,3440,3444,3443,3445,3453,3457,3458,3456,3461,3452,3468,3467,3470,3464,3459,3463,3462,3460,3466,3454,3450,3449,3448,3451,3447,3446,3442,3441,3438,3471,3469"]

Which is fine, and old galleries created in previous versions still appear to work. My problem is I have a summary page grabbing the first image of every child page. The code is something like this....

                                                            $args = array(
                                                            'post_type' => 'attachment',
                                                            'post_parent' => $page->ID,
                                                            'orderby' => 'menu_order ID',
                                                            'order'=> 'asc',
                                                            'numberposts' => 1,
                                                            );
                                                        $attachments = get_posts($args);

This now doesn't work (I'm guessing because gallery order is now based on the ID's) Any way to fix it? Thanks