Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Created June 4, 2013 14:20
Show Gist options
  • Save jeremyboggs/5706292 to your computer and use it in GitHub Desktop.
Save jeremyboggs/5706292 to your computer and use it in GitHub Desktop.
Sort Omeka Items alphabetically by title by default.
<?php
function custom_item_browse_sql($select, $params) {
$sortField = 'Dublin Core,Title'; // 'Element Set Name, Element Name'
$sortDir = 'ASC'; //ASC or DESC
if (!isset($params['sort_field'])) {
$select->reset('order');
get_db()->getTable('Item')->applySorting($select, $sortField, $sortDir);
}
}
add_plugin_hook('item_browse_sql', 'custom_item_browse_sql');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment