Gallery Shortcode Orderby?
-
I use the Sandbox template frame for my WordPress, it’s function.php has override some default templates including Gallery shorcode. I have tried to modify “orderby” code to replace the thumbnails order. but it doesn’t work, whether “ID DESC”,”menu_order DESC”,or “ID ASC” etc. the thumbnails always listed as “5 4 3 2 1”, how do i replace them to “1 2 3 4 5”?
code below
// Function to filter the default gallery shortcode function sandbox_gallery($attr) { global $post; if ( isset($attr['orderby']) ) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if ( !$attr['orderby'] ) unset($attr['orderby']); } extract(shortcode_atts( array( 'orderby' => 'ID DESC', 'id' => $post->ID, 'itemtag' => 'li', 'icontag' => 'div', 'captiontag' => 'span', 'columns' => 99, 'size' => 'thumbnail', ), $attr )); $id = intval($id); $orderby = addslashes($orderby); $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}");
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Gallery Shortcode Orderby?’ is closed to new replies.