Tag Documentation

Tags

These terms are used throughout the documentation:
required: This parameter/field is required for this tag to function.
form only: This can only be set as a field in the form and not as a parameter in the tag.
param only: This parameter can only be set in the tag and not as a field in the form.
fixed value: This field cannot be edited and is set with a fixed value.
recurring only: This parameter/field only applies to recurring charges.
one-time only: This parameter/field only applies to one-time charges.
added in X.X.X: This parameter/field is only available from this version forward.
logged in: This tag is only available if the user is logged in.
has the following front-end tags:
{exp:tag:tags}
This template tag allows you to display the tags that have been assigned to a specific channel entry. In other words, when you're viewing a channel entry, this will show something like: Please be sure NOT to name your custom tag field anything like tag or any of the other variables below, as it will conflict with the names. Because Tag is a fieldtype, you can also display raw Tag data through traditional custom field parsing. All of the same parameters and variables are available, if you wish to use that approach.
{exp:tag:tag_name}
This template tag makes it easy for you to parse out a clean tag name in your page. It detects the tag(s) passed to it and in the case of multi-word tags, simply converts the space separator character to spaces. It also does capital case on all words. You would typically use this for a page heading on a page that is displaying entries that are assigned a specific tag (or set of tags).
{exp:tag:stats}
This template tag allows you to display some basic stats on all tags on your site.
{exp:tag:cloud}
This function creates a list or "cloud" of all tags in the database, and can be filtered down to specific Tag groups, channels, categories, and more. Furthermore, the tag cloud can be weighted through different methods, such as how many entries are assigned to them, or how many times they've been clicked. If you wish to use the weighted cloud method: the number of times the highest ranked tag is used establishes the top of the scale with 0 as the bottom. You can specify the number of groups into which your tags will be sorted. Each of your tags will be evaluated as to which group they belong in. They will be given a numerical ranking based on this. CSS styling is then used to convert that number value into a font size. For example, imagine you have 3 tags on your site: apple, orange and pie. You specify that you want to show a cloud with 3 groups. If apple is used 12 times, orange 7, and pie 1, the top of your scale will be 12. apple will get the highest rank and the largest font size. pie will get the smallest ranking and font size. orange will get the middle font because it falls into the middle grouping. The range for falling into the lowest group would be 0-4. For the middle, 5-8. And for the top, 9-12.
{exp:tag:tags}
This template tag allows you to display the tags that have been assigned to a specific channel entry. In other words, when you're viewing a channel entry, this will show something like: Please be sure NOT to name your custom tag field anything like tag or any of the other variables below, as it will conflict with the names. Because Tag is a fieldtype, you can also display raw Tag data through traditional custom field parsing. All of the same parameters and variables are available, if you wish to use that approach.
Tag Parameters
backspace
integer
This parameter will remove the last specified amount of characters from your results. A typical usage for this would be to remove the last comma, should you choose to separate your tags by commas.
{exp:tag:tags backspace="2"}
case
This parameter alllows you to control the case output of the tag name. Options include: upper - ex: TAG NAME : lower - ex : tag name : title (default) - ex: Tag Name : sentance - ex:Tag name : none - ex : outputs no case modification to the tag, but strips the websafe character from multiword tags
{exp:tag:tags case="lower"}
dynamic
By default, this tag will search the URI for an entry ID or URL title. This parameter allows you to disable this dynamic checking.
{exp:tag:tags dynamic="no"}
entry_id
integer
This parameter is available should you need to hardcode a specific entry ID, or if you need to pass the entry ID through an embedded template. It is also necessary if you're using the Tag:Tags loop on a multi-entry page. Best practice is to always specify it. This parameter should NOT be used if you're using the custom field variable pair approach ({TAG_FIELD_NAME}{/TAG_FIELD_NAME}).
{exp:tag:tags entry_id="{entry_id}"}
limit
integer
You can limit the number of tags returned by using this parameter.
{exp:tag:tags limit="10"}
orderby
This parameter allows you to set a specific order to your tags. Available methods are: tag_name (default) - alphabetically order tags clicks - total number of clicks each tag has received (loaded into Tag:Entries) total_entries - total number of channel entries the tag has been assigned to entry_date - date the tag was first created edit_date - date that the tag was last used in an entry
{exp:tag:tags orderby="clicks"}
paginate
Pagination works just like it does in the Channel:Entries tag. When specified, and used in conjunction with the tag_paginate variable pair, pagination will display. Refer to Channel:Entries tag documentation for more information.
{exp:tag:tags paginate="both"}
sort
string
This parameter allows you to control the output order. Available methods are ascending (asc) or descending (desc) order.
{exp:tag:tags sort="asc"}
tag_group_id
This parameter allows you to narrow down or filter the tag results in the list by specifying the tag group ID. Separate multiples with the pipe character.
{exp:tag:tags tag_group_id="3"}
tag_group_name
This parameter allows you to narrow down or filter the tag results in the list by specifying the tag group short name. Separate multiples with the pipe character.
{exp:tag:tags tag_group_name="group1|group2"}
websafe_separator
This parameter allows you to control the websafe separator character for multi-word tags in the URI. Allowable characters are +, -, and _. The default is +. Be sure to use this parameter consistently throughout your site if you change from the default value of +. For example, if you're linking from your Tag cloud to your Tag:Entries page with - as your websafe separator, you'll need to add this same parameter with - as the value for your Tag:Entries page. Otherwise results will NOT show correctly.
{exp:tag:tags websafe_separator="-"}
Variables
clicks
This variable will return the number of times each tag has been "clicked" (viewed in a Tag:Entries loop).
{clicks}
tag
This variable returns the tag name.
{tag}
tag_id
This variable parses the ID of a given tag. This variable would normally be used when creating a link for the tag, and if your tags contain special and/or foreign characters that would cause trouble being placed in the URI.
{tag_id}
total_entries
This variable shows the total number of channel entries that are assigned to each tag.
{total_entries}
tag_count
Just like the {count} variable for Channel:Entries, this variable returns the relative position of the tag within the list of results. For example, if five tags are being displayed, then this variable will parse as 4 for the fourth tag displayed.
{tag_count}
tag_total_results
Just like the {total_results} variable for Channel:Entries, this variable will return the total amount of tag results being displayed. You would typically use this in a conditional statement.
{tag_total_results}
websafe_tag
This variable will be replaced by the tag name where spaces have been replaced by plus signs (+). This makes the tags more safe to place in a URL and for compatibility with web apps like Reddit. You can also change the websafe separator character by using the websafe_separator parameter.
{websafe_tag}
Variable Pairs
tag_paginate
Pagination is available for this tag and works just like regular EE pagination, but each variable/variable pair is prepended with tag_ (except for any variables and variable pairs inside of the tag_pagination_links variable pair). Used in conjunction with the paginate parameter.
{}
Conditionals
tag_no_results
{   {if tag_no_results}  Sorry, no tags are assigned to theis entry.  {/if}   }
{exp:tag:tag_name}
This template tag makes it easy for you to parse out a clean tag name in your page. It detects the tag(s) passed to it and in the case of multi-word tags, simply converts the space separator character to spaces. It also does capital case on all words. You would typically use this for a page heading on a page that is displaying entries that are assigned a specific tag (or set of tags).
Tag Parameters
case
string
This parameter alllows you to control the case output of the tag name. Options include: upper - ex: TAG NAME : lower - ex : tag name : title (default) - ex: Tag Name : sentance - ex:Tag name : none - ex : outputs no case modification to the tag, but strips the websafe character from multiword tags
{exp:tag:tag_name case="lower"}
tag
This parameter is required to parse the tag name. You can pass the tag through the URI (most common) or hard code a tag value. If hardcoding, to specify multiple tags, separate tags with the pipe character.
{exp:tag:tag_name tag="{segment_3}"}
tag_separator
This parameter allows you to specify the character that separates multiple tags in the URI, in the event you're calling multiple tags in the URI. Default is comma (,), but if your site is set to force query strings, EE won't let you have commas in the URI.
{exp:tag:tag_name tag_separator="_"}
websafe_separator
This parameter allows you to control the websafe separator character for multi-word tags in the URI. Allowable characters are +, -, and _. The default is +. Be sure to use this parameter consistently throughout your site if you change from the default value of +. For example, if you're linking from your Tag cloud to your Tag:Entries page with - as your websafe separator, you'll need to add this same parameter with - as the value for your Tag:Entries page. Otherwise results will NOT show correctly.
{exp:tag:tag_name websafe_separator="-"}
Examples
Basic Example
This example would be used in the event you want Tag to automatically pull the currently active tag(s). A primary situation in which you would use this would be on a Tag Entries page to display the tag being listed: If you have multiple Tags in the URL (which might look something like this: https://site.com/entries/black+pants,nachos,tacos/ The above code would output it as: Black Pants, Nachos, Tacos
{<h2> Viewing all entries tagged with: {exp:tag:tag_name tag="{segment_3}" case="title"}</h2>}
{exp:tag:stats}
This template tag allows you to display some basic stats on all tags on your site.
Variables
percent_channel_entries_tagged
This variable returns the percentage of channel entries tagged (ex: 56.85).
{percent_channel_entries_tagged}
total_channel_entries_tagged
This variable returns the total percentage of channel entries tagged (ex: 347).
{total_channel_entries_tagged}
total_tags
This variable returns the total number of tags that exist (ex: 162).
{total_tags}
Examples
Basic Example
The to the right is a basic example of how you might show some Tag stats for your site:
{<p> {exp:tag:stats} There is a total of {total_tags} tags on this site. {total_channel_entries_tagged} entries are tagged ({percent_channel_entries_tagged}%). {/exp:tag:stats} </p> }
Tag Parameters
entry_id
string
Tag:Related_Entries will normally read the entry ID dynamically when viewing a single entry page. However, if you wish to use this on a multiple entry page, and/or use embeds, this parameter is available for use.
{exp:related:entries entry_id="{entry_id}"}
exclude
string
This parameter allows you to exclude entries based on specified tags from showing up. For multiples, separate by pipe character. Additionally, to exclude "LIKE" tags, use the % symbol as a wildcard. For example, exclude="%dog" would exclude the sled dog tag.
{exp:related:entries exclude="tacos|nachos|peanuts"}
limit
This parameter allows you to set a maximum amount of results to display for this tag.
{exp:related:entries limit="5"}
orderby
This parameter lets you specify the order in which you'd like your entries to display. Most Channel:Entries options are available here. Additionally, you can use relevance. When specifying relevance, it will order your entries by amount of tags that match. For example, if an entry has 3 matching tags, and two other entries have only 1 matching tag, the entry with 3 matching tags will rank higher than the others. Also, specifying relevance enables the tag_relevance and tag_relevance_percent variables.
{exp:related:entries orderby="releance"}
paginate
Pagination works just like it does in the Channel:Entries tag. When specified, and used in conjunction with the tag_paginate variable pair, pagination will display. Refer to Channel:Entries tag documentation for more information.
{exp:related:entries paginate="both"}
rank_limit
This parameter ranks the tags that belong to the primary entry of the page. It chooses the top ranked of those tags, limiting that selection by the number you provide in the parameter. Then pulls related entries that have those top ranked tags in common with the primary entry of the page. Tags can be ranked by how often they are used, by how often they are clicked or both. See the rank_method parameter.
{exp:related:entries rank_limit="5"}
rank_method
A tag can be ranked by how often it is clicked on the site, by how many entries use it, or both. You can show related entries by tag rank and you can establish the ranking method using this parameter. Allowed values are clicks and total_entries. You can indicate both by joining the two with the pipe character.
{exp:related:entries rank_method="clicks|total_entries"}
tag_group_id
This parameter allows you to narrow down or filter the results by specifying the tag group ID. Seperate multiples with the pipe character.
{exp:related:entries tag_group_id="3"}
tag_group_name
{exp:related:entries tag_group_name="group1|group2"}
url_title
Tag:Related_Entries will normally read the entry ID or URL title dynamically when viewing a single entry page. However, if you wish to use this on a multiple entry page, and/or use embeds, this parameter is available for use.
{exp:related:entries url_title="{segment_3}"}
Variables
tag_relevance
This variable displays the amount of tag matches the related entry and the main entry have. This variable only works with the orderby="relevance" parameter specified.
{tag_relevance}
tag_relevance_percent
This variable displays the percentage of the amount of tag matches the related entry and the main entry have. This variable only works with the orderby="relevance" parameter specified.
{tag_relevance_percent}
Tag Parameters
tag
required
This parameter is required to display entries that have been assigned the selected tag. You can pass the tag through the URI (most common) or hard code a tag value. If hardcoding, to specify multiple tags, separate tags with the pipe character.
{exp:tag:entries tag="{segment_3}"}
entry_id
not
Used for LIMITING the entry ids given in the list. It is delimited by the pipe character. This parameter is useful when you want to exclude certain entries from the list. For example, if you wanted to show a similar articles section based on a tag but did not want the same article to show in recomended as the one being viewed.
accepts: a pipe delimited list of entry_ids not to show up. Must have "not " in front of the list.
{exp:tag:entries entry_id="not 7|16|46"}
inclusive
You can pull entries by multiple tags when tags are separated by commas in the URI. If you set this parameter to yes, only entries that contain all of the tags will be shown. Otherwise, the default method just checks to see if any of the tags match.
{exp:tag:entries inclusive="yes"}
paginate
Pagination works just like it does in the Channel:Entries tag. When specified, and used in conjunction with the tag_paginate variable pair, pagination will display. Refer to Channel:Entries tag documentation for more information.
{exp:tag:entries paginate="both"}
tag_group_id
integer
This parameter allows you to narrow down or filter the tag results in the list by specifying the tag group ID. Seperate multiples with the pipe character.
{exp:tag:entries tag_group_id="3"}
tag_group_name
This parameter allows you to narrow down or filter the tag results in the list by specifying the tag group short name. Seperate multiples with the pipe character.
{exp:tag:entries tag_group_name="group1|group2"}
tag_separator
This parameter allows you to specify the character that separates multiple tags in the URI, in the event you're calling multiple tags in the URI. Default is comma (,), but if your site is set to force query strings, EE won't let you have commas in the URI.
{exp:tag:entries tag_separator="_"}
websafe_separator
This parameter allows you to control the websafe separator character for multi-word tags in the URI. Allowable characters are +, -, and _. The default is +. Be sure to use this parameter consistently throughout your site if you change from the default value of +. For example, if you're linking from your Tag cloud to your Tag:Entries page with - as your websafe separator, you'll need to add this same parameter with - as the value for your Tag:Entries page. Otherwise results will NOT show correctly.
{exp:tag:entries websafe_separator="-"}
{exp:tag:cloud}
This function creates a list or "cloud" of all tags in the database, and can be filtered down to specific Tag groups, channels, categories, and more. Furthermore, the tag cloud can be weighted through different methods, such as how many entries are assigned to them, or how many times they've been clicked. If you wish to use the weighted cloud method: the number of times the highest ranked tag is used establishes the top of the scale with 0 as the bottom. You can specify the number of groups into which your tags will be sorted. Each of your tags will be evaluated as to which group they belong in. They will be given a numerical ranking based on this. CSS styling is then used to convert that number value into a font size. For example, imagine you have 3 tags on your site: apple, orange and pie. You specify that you want to show a cloud with 3 groups. If apple is used 12 times, orange 7, and pie 1, the top of your scale will be 12. apple will get the highest rank and the largest font size. pie will get the smallest ranking and font size. orange will get the middle font because it falls into the middle grouping. The range for falling into the lowest group would be 0-4. For the middle, 5-8. And for the top, 9-12.
Tag Parameters
day_limit
integer
Using this parameter, you can filter your list of tags by those which have been used within the last number of days.
{exp:tag:cloud day_limit="5"}
category
string|integer
This parameter allows you to filter your results by tags that are associated to entries which in turn are associated to specified categories. You can specify a category ID or a category url_title. You can hardcode the value, pass it through an embed, or grab it from the URI. Seperate multiples with the pipe character.
{exp:tag:cloud category="12|15"}
exclude
This parameter allows you to exclude tags from the list by the tag name. For multiples, separate by pipe character. Additionally, to exclude "LIKE" tags, use the % symbol as a wildcard. For example, exclude="%dog" would exclude a tag named sled dog.
{exp:tag:cloud exclude="burger|hammy|pimpkins"}
fixed_order
integer
This parameter allows you to filter down your tag results and set them into a fixed order by specifying ID's of tags. Seperate multiples with the pipe character
{exp:tag:cloud fixed_order="81|17|26|43"}
groups
This parameter tells the Tag cloud how many groups to divide your tags into. For example, if you specify 5, it will create 5 groups and place the tags into the appropriate group based on their ranking. This will determine the font size for each tag.
{exp:tag:cloud groups="5"}
limit
integer
This parameter allows you to limit the number of tags displayed.
{exp:tag:cloud limit="20"}
most_popular
This parameter allows you to filter all tags by popularity before the orderby parameter kicks in. This means that you can show all of your most popular tags, then order them how you wish.
{exp:tag:cloud most_popular="30"}
orderby
string
This parameter allows you to order your tags by the method you wish. Available methods are: count - total number of instances of each tag across channel entries, within the specified parameters. : clicks - number of times the tag can been clicked on. : total_entries - total number of instances of each tag across channel entries, regardless of status. : tag_name - the name of the tag (default).: random - random display order.
{exp:tag:cloud orderby="total_entries"}
paginate
string
Pagination works just like it does in the Channel:Entries tag. When specified, and used in conjunction with the tag_paginate variable pair, pagination will display. Refer to Channel:Entries tag documentation for more information.
{exp:tag:cloud paginate="both"}
rank_by
This parameter allows you to weigh your tags by clicks or entries. Default is entries. For example, if you specify clicks, it will weight the tags by the amount of "clicks" each tag has received.
Default: entries
{exp:tag:cloud rank_by="clicks"}
sort
string
This parameter allows you to sort tags by ascending (asc) or descending (desc) order. Default is desc.
Default: desc
{exp:tag:cloud sort="asc"}
start
integer
This parameter controls which integer of font size to start counting. This affects the size variable which sets the font size of each tag in your cloud.
{exp:tag:cloud start="10"}
step
integer
This parameter controls the amount to increment the size variable. This allows you to create greater differences in font sizes between tag groups.
{exp:tag:cloud step="2"}
tag_id
This parameter allows you to narrow down or filter the tag results in the list by specifing ID's of tags. Seperate multiples with the pipe character.
{exp:tag:cloud tag_id="not 12|82|48"}
tag_name
This parameter allows you to narrow down or filter the tag results in the list by specifing names of tags. Seperate multiples with the pipe character.
{exp:tag:cloud tag_name="not cheese|pies|corn"}
tag_group_id
integer
This parameter allows you to narrow down or filter the tag results in the list by specifying the tag group ID. Seperate multiples with the pipe character.
{exp:tag:cloud tag_group_id="3"}
tag_group_name
This parameter allows you to narrow down or filter the tag results in the list by specifying the tag group short name. Seperate multiples with the pipe character.
{exp:tag:cloud tag_group_name="group1|group2"}
websafe_separator
This parameter allows you to control the websafe separator character for multi-word tags generated by the websafetag variable. Allowable characters are +, -, and *. The default is +. Be sure to use this parameter consistently throughout your site if you change from the default value of +. For example, if you're linking to your Tag:Entries page with - as your websafe separator, you'll need to add this same parameter with - as the value for your Tag:Entries* page. Otherwise results will NOT show correctly.
{exp:tag:cloud websafe_separator="-"}
Variables
clicks
This variable will return the number of times each tag has been "clicked" (viewed in Tag:Entries loop).
{clicks}
count
This variable will return the total number of instances of each tag across channel entries, within the specified parameters. For example, specifying the status parameter would affect the count on this variable.
{count}
position
This variable will return the relative position of the tag within the sequence of tags in the list.
{position}
size
This variable will return a numeric value of the relative rank of the tag within the sequence of tags in the list.
{size}
step
This variable relates to the step parameter. It helps you represent the breakpoints between groups of tags by their rank. The usual usage for this is to set the different font sizes of the tags to create the "cloud" effect.
{step}
switch
This variable will alternately output each of the two values you provide. You would typically use this with with CSS.
{switch="styleOne|styleTwo"}
tag
This variable returns the tag name.
{tag}
tag_id
This variable parses the ID of a given tag. This variable would normally be used when creating a link for the tag, and if your tags contain special and/or foreign characters that would cause trouble being placed in the URI.
{tag_id}
total_entries
This variable shows the total number of channel entries that are assigned to each tag. It is not affected by the parameters specified. For example, specifying the status parameter would NOT affect the count on this variable.
{total_entries}
total_entries_1
This variable works like the total_entries variable, but it allows you to display the amount of entries that contain the given tag for the specified Tag group. It is not affected by the template parameters specified. For example, specifying the status parameter would NOT affect the count on this variable. To construct this variable, simply take totalentries and append the unique Tag group ID number to it.
{total_entries_1}
total_entries_article_tags
This variable works like the total_entries variable, but it allows you to display the amount of entries that contain the given tag for the specified Tag group. It is not affected by the template parameters specified. For example, specifying the status parameter would NOT affect the count on this variable. To construct this variable, simply take totalentries and append the unique Tag group short name to it.
{total_entries_article_tags}
total_results
This variable will return the total amount of tags results being displayed in the cloud. You would typically use this in a conditional statement.
{total_results}
websafe_tag
This variable will be replaced by a tag name where spaces have been replaced by plus signs (+). This makes the tags more safe to place in a URL and for compatibility with web apps like Reddit. You can also change the websafe seperator character by using the websafe_separator parameter.
{websafe_tag}

Support

Having problems setting up and/or using Tag? Support is offered from 10am to 4pm EST weekdays. Send us an email at help@eeharbor.com and we will respond as quickly as we can.

loading