Skip to content

Instantly share code, notes, and snippets.

@sebbdk
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save sebbdk/d3b383bf2be557990dd1 to your computer and use it in GitHub Desktop.

Select an option

Save sebbdk/d3b383bf2be557990dd1 to your computer and use it in GitHub Desktop.
ridiculous!
if (is_admin())
{
if ($options['adminsort'] == "1" &&
//ignore when ajax Gallery Edit default functionality
!($options['adminsort'] == "1" && defined('DOING_AJAX') && isset($_REQUEST['action']) && $_REQUEST['action'] == 'query-attachments')
)
{
$orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
}
}
else
{
//ignore search
if($query->is_search())
return($orderBy);
if ($options['autosort'] == "1")
$orderBy = "{$wpdb->posts}.menu_order, " . $orderBy;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment