Functions/item tags as string

The item_tags_as_string will display the tags for an item as a string.

Usage

<?php item_tags_as_string(
    $delimiter = ', ', 
    $order = 'alpha', 
    $tagsAreLinked = true, 
    $item=null, 
    $limit=null
);
?>

Arguments

  • delimiter - The character or text to put between each tag. A comma is used by default.
  • order - The order in which tags are displayed. The default value is alphabetical. Available values include:
    • recent
    • most
    • least
    • alpha
  • tagsAreLinked - (boolean) Determines whether individual tags are linked to the items/browse page to show all items for that tag. Default is true.
  • item - The item object. Default is null. If null, the current item is used.
  • limit - The number limit of tags you want to display. Default is null. If null, all tags are returned.

Examples

Default Usage

The following example is used in the items/show.php template in the default theme:

<?php echo item_tags_as_string(); ?>

Using a Different Delimiter

The following example will use a pipe (|) in between each tag.

<p><?php echo item_tags_as_string(' | '); ?></p>

This will display:

<p>amet | dolor | ipsum | lorem</p>