Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Created September 20, 2011 02:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyboggs/1228149 to your computer and use it in GitHub Desktop.
Save jeremyboggs/1228149 to your computer and use it in GitHub Desktop.
Filter the collections browse SQL to sort records alphabetically by name.
<?php
/**
* Filter the collections browse SQL to sort records alphabetically by name.
*/
function filter_collections_alphabetically($select, $params)
{
if (!array_key_exists('sort_field', $params)) {
$select->order('c.name ASC');
}
return $select;
}
add_plugin_hook('collection_browse_sql', 'filter_collections_alphabetically');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment