[wp-trac] [WordPress Trac] #6476: 2.5 Gallery shortcode orderby not
working
WordPress Trac
wp-trac at lists.automattic.com
Sun Mar 30 18:33:24 GMT 2008
#6476: 2.5 Gallery shortcode orderby not working
---------------------------+------------------------------------------------
Reporter: GeoffHarrison | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.7
Component: General | Version:
Severity: normal | Keywords:
---------------------------+------------------------------------------------
The orderby gallery shortcode has no effect on the order of the images in
the gallery. The SQL it generates is incorrect. A gallery shortcode
[gallery columns="4" orderby="post_name ASC"] generates the SQL query
{{{
SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_type = 'attachment'
AND wp_posts.post_parent = 8 AND (post_mime_type LIKE 'image/%') GROUP
BY wp_posts.ID ORDER BY "post_name ASC" DESC
}}}
The ORDER BY clause is incorrect. In fact, even a default [gallery]
shortcode generates an invalid ORDER BY:
{{{
...ORDER BY "menu_order ASC, ID ASC" DESC
}}}
It should be unquoted and without the final DESC.
--
Ticket URL: <http://trac.wordpress.org/ticket/6476>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list