Skip to main content
14 votes

How can I create a visually weighted tag cloud?

Marion Newlevant had a clever, efficient idea in this Straight Up Craft Hangout if you don't mind having a slight lag (like a day) for your tag counts to be up to date. That idea: store the counts you ...
Matt Stein's user avatar
  • 4,006
6 votes
Accepted

How do I add a value to a tag field type using the entries service saveEntry method?

The Tags field classifiedTags needs an array of tag IDs, not slugs/titles. Also, if this is an existing entry and you want to retain tags already added to the field, you'll need to pull the existing ...
Mats Mikkel Rummelhoff's user avatar
5 votes

How do I UNLOCK my account?

If you don’t have access to another admin account, you could unlock the account directly in the database. Change the lock value to 0 for the account in the craft_users table.
carlcs's user avatar
  • 36.3k
5 votes
Accepted

Confused about tags

You told Craft to look for tags/_tag And then you created templates/tags/_tags.html Note you have no s on the end in the route definition, but you do in the template name.
Jeremy Daalder's user avatar
5 votes
Accepted

SEO titles/descriptions for tags and archive pages

The better approach in my opinion is to declare the variables in the corresponding templates rather than in the _layout template Layout.twig {% if seoTitle is not defined or seoTitle is empty %} ...
Robin Schambach's user avatar
5 votes

Still not able to manage tags in Craft 3?

Short answer is "no, this still isn't possible". Longer answer is: The Tag Manager plugin from Craft 2 will not be ported. Pixel & Tonic have mentioned the possibility of rolling that ...
Lindsey D's user avatar
  • 24k
5 votes

How to delete tags in Craft CMS 3

Yes the same still applies. You can either delete it via DB directly in your {{%elements}} column or you can just run PHP Craft::$app->getElements()->deleteElementById(x) Twig {% do craft....
Robin Schambach's user avatar
5 votes
Accepted

How to delete tags in Craft CMS 3

I do believe this plugin can help? https://github.com/ethercreative/tags
Jay's user avatar
  • 1,042
4 votes
Accepted

How do I display tags comma separated with "and" between the last two tags?

Bit of an old question, but here's a (subjectively) more elegant solution than the accepted answer using loop.revindex0: {% for tag in tags %} {{ tag.type }}{{ loop.revindex0 == 1 ? ' and' : loop....
Andy's user avatar
  • 156
4 votes

List entries for a single tag from blog section

You were very close! You are looping through craft.entries.section('blog') which doesn't use your tag query. You simply need to loop through the results of your query which you've set in the entries ...
Luke Pearce's user avatar
  • 3,863
4 votes
Accepted

Show all tags related to a category?

You can use the relatedTo param on craft.tags like you can with any Element inside Craft. All Elements inside Craft can be related to one another. There is a .relatedTo parameter available on all of ...
Luke Pearce's user avatar
  • 3,863
4 votes
Accepted

How to display number of entries for a tag and not display if no entries?

Something like this should work: {% set tags = craft.tags.limit(null).relatedTo(craft.entries.limit(null)).order('title') %} {% for tag in tags %} <a href="/tags/{{ tag.slug }}">{{ tag....
Mats Mikkel Rummelhoff's user avatar
4 votes
Accepted

Where are tags stored in the database?

Tags are Elements and are stored in multiple places in the database, so editing the db directly may not be as easy as just finding the Tags you want and deleting them. The tag itself is stored in ...
Ben Parizek's user avatar
  • 13.5k
3 votes
Accepted

Use of tag.slug instead of tag.title in a custom route

You do not have to change your route. Instead modify your template where you are linking the tag. Instead of using <a href="{{ siteUrl }}tags/{{ tag.title | url_encode }}">{{ tag.title }}, <...
Fyrebase's user avatar
  • 735
3 votes
Accepted

Tag overview in the Craft backend

There is a Tag Manager plugin you can use for this. You might also want to consider voting for this feature request if you think this should be in core!
Brad Bell's user avatar
  • 67.5k
3 votes

Tag mysteriously not found

You don't need to use the search parameter in this case. I'd avoid using it where ever possible. {% set tag = craft.tags.slug(slug).first() %}
carlcs's user avatar
  • 36.3k
3 votes

How do I delete a tag?

There is a third-party plugin called Tag Manager that let's you delete tags.
Alex Roper's user avatar
  • 2,642
3 votes
Accepted

Best method to handle %20 in tag URLs with multiple words

Update. After looking at the tag model a little more closely, it looks like tags have both a title and slug — so if you use the slug to construct your url then you shouldn't have that problem. For ...
Douglas McDonald's user avatar
3 votes
Accepted

List entries without specific tag

You could try something like following reducing the tagged entries into IDs that you then filter against (see this thread): {% set tag = craft.tags.search('All-Stars').first() %} {% set allEntries = ...
Cole Henley's user avatar
  • 1,741
3 votes

Most related articles

If you're only trying to find related articles based on elements (ie tags, categories, entries, etc), you can use my Similar plugin. Here's a basic example, more info in the repo: {% set ...
André Elvan's user avatar
  • 7,288
3 votes
Accepted

Get random entry tagged with

You could try customizing the order parameter. MySQL allows ordering randomly by using .. ORDER BY rand(). So you could try the following: craft.entries.section('featured').order('rand()').first()
pauliusef's user avatar
  • 163
3 votes
Accepted

Difference between {% includeCssFile %} or including it with <link>

The difference is that {% includeJsFile %} can be called in any template or template part and will add the script to the bottom of the page (as explained here). So you could, for example, have a ...
mrsmn's user avatar
  • 731
3 votes
Accepted

Sort entries by best match to multiple categories

Have a look at the Similar plugin https://github.com/aelvan/Similar-Craft, it should do exactly what you’re looking for. {% set baseCriteria = craft.entries({ order: 'postDate desc', limit: 5,...
carlcs's user avatar
  • 36.3k
3 votes
Accepted

How can I add programmatically a Tag after SAVE_ON event in case of Assets types

A Tag field is like every other relation field. Just insert an array of ids in the field and save the element $element->setFieldValue('fieldHandle', [1,2,3,4,5,6]); Craft::$app->getElements()-&...
Robin Schambach's user avatar
3 votes
Accepted

Still not able to manage tags in Craft 3?

Similar to the deprecated Tag Manager, there is Tags by Ethercreative for Craft CMS 3. Not only can you inspect and delete, but also replace tags, with an indication in how many instances the tag is ...
Avant la lettre's user avatar
3 votes
Accepted

Are categories first class citizens compared to tags?

I would say "kind of", depending on what you're expecting them to do. Tags in Craft behave the way tags have typically been implemented in CMSes before: they are lightweight, auto-fill ...
Evan Warner's user avatar
2 votes

Order tags by count - e.g. Top 10 Tags Used

Have had success using this plugin: https://github.com/philbirnie/CraftPopularTags
PhilR's user avatar
  • 418
2 votes

Order tags by count - e.g. Top 10 Tags Used

I couldn't quite get Carls answer to work (the "weightedTags"-array wasn't properly sorted), so I went and wrote a quick variable and service for achieving what I was after. First off, the super-...
Fuglsetrampen's user avatar
2 votes

Is it possible to order related entries by relevance of tags?

I've made a plugin called Similar that does exactly this. Give it a go.
André Elvan's user avatar
  • 7,288
2 votes
Accepted

List entries for a single tag from blog section

Luke's answer is correct. Your issue is that you have two tag groups defined (default and blogTags) and you happen to have a weddings tag defined for both groups. The Tag field you have in your blog ...
Brad Bell's user avatar
  • 67.5k

Only top scored, non community-wiki answers of a minimum length are eligible