In my new Omeka template I need to have different number of results per page on the items/browse and search results page. I want to display i.e. 5 items per page while browsing items and 10 items per page on the items search results page.
I tried to add a different 'per_page' option values to the pagination_links() function inside the items/browse.php and search/index.php but it changes nothing. The value from Appearance->Settings->Results per page is always used.
Is it possible to differentiate the number of results per page some way?
That can be done, but only through a plugin, not the theme. The good news is that the plugin would be super-simple.
It would use the
items_browse_per_page filter and have it just return 5.
I have no big experience in filters yet. I wrote a simple plugin with only two hooks: install and uninstall.
I put the following inside:
public function hookInstall()
public function hookUninstall()
After installing the plugin it does nothing. What is wrong?
You don't do filters with the install and uninstall hooks, you use them basically like hooks: you use
add_filter or the
$_filters property of the AbstractPlugin to attach a function from your plugin to the filter.
protected $_filters = array(
public function filterItemsBrowsePerPage($perPage, $args)
I've tried to flesh out our developer documentation for using filters a tiny bit to give at least a little guidance for how you go about using a filter.
Filters aren't too complicated, especially if you're comfortable with hooks already, but we've done a pretty poor job of trying to explain them.
Luckily we have the forum ;-)