In Drupal 6 you could assign a taxonomy vocabulary to content types.

I can't see this option in Drupal 7 so I'm not sure how to assign a taxonomy term to content. I have the ability to assign tags to an article, but not any of the vocabulary/terms that I've created.

Any help appreciated, thanks.

Comments

yelvington’s picture

There's a lot about Drupal 7 that is designed to be more usable by beginners, but may be confusing if you come from D6 with expectations of where to find your tools. This is one of those situations.

Fields (CCK) have been moved into core, and taxonomy is treated as just another field -- not some separate and special concept.

If you edit your content type (admin->structure->content types) existing vocabularies will be available in the "add existing field" widget. To create a new vocabulary and associate it with a content type, just "add new field" of type "term reference."

You also can go admin->structure->taxonomy and add a vocabulary there, but (as you discovered) that doesn't glue it to the content type.

ChocolateTeapot’s picture

That's really helpful.

Thanks for your time.

aldim’s picture

I've had the same problem and now it's gone :) Thanks!

Stephen Winters’s picture

Hi yelvington,
Thank you so much for this post. Coming from Drupal 6, I couldn't find how to create taxonomy free tagging boxes, and just didn't understand what to do with the taxonomy. I set up a Drupal 7 test site to experiment with, and also searched and searched trying to figure out how to use Taxonomy in Drupal 7. While I don't fully yet understand it, your post has greatly helped me to begin to have a better understanding.

Your statement here...

Fields (CCK) have been moved into core, and taxonomy is treated as just another field -- not some separate and special concept.

.... helped me to get to thinking in a different way. Taxonomy is no longer a separate component, but is now a field. That took some real re-thinking on my part. Your short explanation was very helpful to me. Then, after you explained that it was a different concept, the other part of your post explains how to find and use the Taxonomy fields.

I had looked through the Drupal documentation on Taxonomy and non of this was explained. Your explanation here (perhaps go into just a bit more detail) would be very helpful if it was in the Documentation section. After much frustration, your message was very helpful to me.

After reading your message I have been able to create a taxonomy field and attach it to a node type in my Drupal 7 test site.

I hope you don't mind, but I found your message so helpful that I copied it into the Documentation here: http://drupal.org/node/774884 Feel free to go there and edit and improve it if you wish. I don't yet Drupal 7 taxonomy enough to write something up myself. But I thought your explanation was important enough to be in the documentation.

Thank you, Thank you, Thank you,
Best Wishes,
Stephen

kerala’s picture

excellent post..thanks a lot yelvington
but i am still confused
* i created some fields for a vocabulary.But i found no change or effect that it makes.
* i am curious to know what is the significance of the created fields of a vocabulary.that is why or for what purpose do we create fields for a vocabulary..
may be a silly question :)

cfox612’s picture

use it for my "event" content type for selecting the type of event (educational, committee, featured speaker, etc). It's just another way to categorize content for creating custom views to display it.

kerala’s picture

thanks cfox612..

arpas’s picture

I have another question. can I use taxonomy fields in views?

froboy’s picture

If you edit your content type (admin->structure->content types) existing vocabularies will be available in the "add existing field" widget. To create a new vocabulary and associate it with a content type, just "add new field" of type "term reference."

While most of this comment is great, it seems to me that the quoted section above is not quite right. Unless I'm missing something, I always have to create a new Vocabulary via Admin->Structure->Taxonomy before I can reference it in the "Manage Fields" dialog. Right?

kbell’s picture

That's why it says "EXISTING vocabularies will be available" (emphasis mine).

If you edit your content type (admin->structure->content types) existing vocabularies will be available in the "add existing field" widget.

-Kelly Bell
twitter: @kelly, @gothamdrupal
http://gothamcitydrupal.com

vfranklyn’s picture

Hi there,

I created a new vocabulary with terms in Taxonomy in Drupal 7 before I made the content type for it. However, the new vocabulary is not showing up in the 'add existing field' pull down menu. Any ideas?

vfranklyn’s picture

Never mind, I figured it out. You have to create a new field in the content type, under 'Select a Field Type', choose 'Term Reference', then when you hit save, you'll be prompted to add the vocabulary.

tr-drupal’s picture

Hello,

first I'd posted here https://www.drupal.org/node/1355964#comment-9991565 because the sorting by a taxonomy term wasn't working, but after some more research it looks more and more, as if the not working sorting is just a follow-up issue. The real issue seems to be, that the view seems not to recognize the relationship between the content and the taxonomy terms.

I didn't manage to find a solution after a 2-days-research, so posting here, because this issue fits in here rather than in the other thread.

That's what it roughly is about: a website for a software. The software has got different areas / functionalities (contact management, invoice management etc.) One of the pages is a screenshot gallery, which shows screnshots for each area as a colorbox / field-slideshow.

That's what I have done so far (can't upload any screenshots for some reason, so posting the links to an external image hoster (directupload.net):

  1. Taxonomy vocabulary "Program areas" with the areas mentioned above: http://fs1.directupload.net/images/150606/mditkha4.png
  2. Content type "Screenshots Slideshow": http://fs1.directupload.net/images/150606/k36443b8.png
  3. Via the field "Screenshot Kategorie" the relation to the program areas is supposed to happen. It has the correct vocabulary assigned: http://fs2.directupload.net/images/150606/zxit9eu5.png
  4. There are several contents of the content type "Screenshots Slideshow", which are assigned to the appropriate program area / taxonomy term. Here is one example: http://fs1.directupload.net/images/150606/35e5ngqj.png Since I don't want the contents to be accesable separately, I didn't publish them
  5. There is a view, which displays some fields (the last of them has a rewritten result), but it doesn't matter. The behavior is the same when I do output the full content instead of fields as well. That's how the view is set up: http://fs1.directupload.net/images/150606/wxkrwzeg.png
  6. The field "Content: All taxonomy terms" is set up like this: http://fs1.directupload.net/images/150606/b47ikj4i.png
  7. Here the relationship "Content: Taxonomy terms on node": http://fs1.directupload.net/images/150606/he733ho4.png
  8. The sorting criteria: http://fs1.directupload.net/images/150606/z3zpk4w6.png
  9. And here is the output: http://fs1.directupload.net/images/150606/rad5pxlp.png as you can see in point 1, the order should be "Contact management", "Product management", "Purchase & ordering" etc., not how it is on the screenshot...

While doing some troubleshooting I've found out, that once I turn on the option "Require this relationship" for the added relation "Content: Taxonomy terms on node", the view doesn't output anything anymore. Also when I had added the field "(Program areas) Taxonomy term: Weight" to the output field list (after turning off the require option again), the weight of all displayed items was 0. So the view doesn't recognize the relationship for some reason, although the structure within the database looks alright as well (found some hints for what to check).

While writing this, I was using my test environment and had one last idea just in this moment, when trying to set up a new view. When I saw the default filter criteria "Content: Published (Yes)", I remembered, that my contents were not published. I've published them as a test and.... it worked! The displayed weight of taxonomy terms is correct, the sorting seems to work, the option "Require this relationship" does still output all the contents...

So a relationship bewteen the contents and taxonomy terms is only recognized within a view, when the contents are published, which looks like a bug to me though. I didn't want my contents to be available as separate pages, but only as the source for the view(s). Since there is the filter criteria "Content: Published (Yes/No)" for views, they seem to be designed to support the output of the not published contents as well, so I think the relations to taxonomy terms should work for such not published contents as well.