Functions/get tags

< Functions(Redirected from Theme API/get tags)

This page is outdated

The information on this page concerns an old or obsolete version of Omeka. If you are using a more recent version, instead see get_records on Read the Docs.

The get_tags() will retrieve an array of tags based on a given query.

Usage

<?php get_tags($params = array(), $limit = 10); ?>

Arguments

  • params - (array) An array of parameters. Parameters include:
    • 'sort' - Values include 'recent', 'least', 'most', 'alpha', 'reverse_alpha'
    • 'limit' - integer
    • 'record' - instance of Omeka_Record
    • 'entity' - The entity_id.
    • 'user' - The user_id who created tags
    • 'like' - A partial tag name.
    • 'type' - The type of tag. Values include 'item' and 'exhibit' if the ExhibitBuilder plugin is installed and used.
  • limit - The maximum number of tags to return. Default is 10. If set to null, all tags that match the given parameters will be returned.

Examples

The following example will create a string of twenty tags, sorted alphabetically, which can then be displayed on the index.php template file in your theme, or anywhere you wish to display it:

<?php
$tags = get_tags(array('sort' => 'alpha'), 20); 
echo tag_string($tags,uri('items/browse'));
?>