The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [taxonomy-terms]

"Taxonomy" refers to Drupal's content classification mechanism, organised into vocabularies and terms.

Filter by
Sorted by
Tagged with
106
votes
3answers
66k views

Views contextual filters taxonomy name

I'm adding a contextual filter to a view for a custom content type that has a taxonomy field. The contextual filter allows me to filter by the taxonomy tag id but not by the taxonomy tag name. Meaning ...
32
votes
5answers
65k views

How to get taxonomy term name from tid?

A lot of our stuff has uris formatted like site/taxonomy/XX, where XX is an integer. I found a lot of questions like "how to get the TID from the name?", but I'd like to get the name from the TID. I'...
32
votes
5answers
30k views

Views and node count for taxonomy terms

How can I display the node count values for taxonomy terms in Views? with sorting the result list in descending order of node count.
32
votes
6answers
20k views

Programmatically create a term?

I'm attempting to add a lot of terms (~200) to a vocabulary, but I can't find any import modules that are updated for Drupal 8, and it seems the functions for doing this in Drupal 7 don't exist in ...
28
votes
5answers
21k views

How do I override a taxonomy/term/% list with a view?

I have a vocabulary attached to a content type. Only one term can be selected to categorize a node made with this content type. The vocabulary is called Vehicles and has terms 'cars, trucks, boats.' ...
25
votes
2answers
45k views

List all terms from a vocabulary

I have a taxonomy called services and want to list out all the terms. I can load the vocab with $vocabulary = taxonomy_vocabulary_machine_name_load('Services') but cannot seen to get all the terms ...
24
votes
7answers
15k views

Where do I find the vocabulary ID ($vid)?

In Drupal 6 I would go to the taxonomy section of my /admin and I'd be able to find the $vid (numerical) in the URL. In Drupal 7 (no doubt due to the introduction of terms as entities) the URL is no ...
23
votes
4answers
6k views

Clean way of building simple taxonomy browser of arbitrary depth

I have spent days trying to determine a clean way to do the following: Display a list of all top-level terms in a vocabulary with links to their child terms Upon clicking a link, be taken to a list ...
22
votes
8answers
17k views

How do I create a nested tree with terms & nodes with Views 3?

I need to create something similar like this: Colors (Vocabulary) Red (term) Dark (term) Node 1 Node 2 Light (term) Node 3 Node 4 Blue (term) Node 5 Node 6 Green (term) Node 7 Node 8 (...
22
votes
2answers
4k views

Are there any benefits/caveats with using Entity Reference over Term Reference?

Pretty simple question really, but is there any benefit to using a core term reference field over an Entity Reference field? Obviously tagging is not really an option with Entity Reference, but I've ...
21
votes
4answers
18k views

Load term by name

In Drupal 7, we can load the term using name for ex. taxonomy_get_term_by_name($name) Is there any way to load term via given name in Drupal 8?
20
votes
6answers
32k views

How to show terms in a Views in its hierarchical structure?

I have create a view to show the terms of the Products vocabulary. I the view I set: Format: Html list Show: field Fields: Taxonomy term: Name It works fine but it the hierarchical structure is ...
20
votes
1answer
4k views

How to get taxonomy synonyms working robustly with Search API?

Tag synonyms are a popular, important feature in many sites (used here on StackExchange, for example), and taxonomy synonyms used to be part of Drupal 6's core Taxonomy module, before being dropped in ...
19
votes
3answers
18k views

How do I get the taxonomy term ID from its name?

The only function on the list of taxonomy.module functions that looks like it does what I want appears to be a private function (_taxonomy_get_tid_from_term). What function am I supposed to use if ...
19
votes
4answers
11k views

Clean urls - auto path alias - how to remove accents (Á É Ó Í Ñ ) from the urls?

I´m using Drupal 7.9 and pathauto 7.x-1.0-rc2 I want to remove the accents from the paths and replace them with normal letters Á=A É=E Ó=O Í=I Ñ=N etc. I'm using a taxonomy field type and node ...
18
votes
4answers
19k views

How to set a taxonomy term programmatically for a node?

I created taxonomy terms and assigned it to a content type 'Article' using term reference field. I created nodes by programmatically but how to set taxonomy terms for the nodes? The taxonomy terms ...
18
votes
4answers
7k views

How to combine views exposed filter with search?

My client asked me for a single field, that would work 2 ways: Autocomplete filter based on taxonomy. If site visitor inputs something that's not in taxonomy, full text search should be performed on ...
18
votes
4answers
5k views

How to hide “Manage Fields” and “Manage Display” tabs

I'm making a website with Drupal 7, and I was looking through the permissions for Taxonomies. I wanted to give the website maintainers a central place to manage the vocabularies and add terms, sort ...
17
votes
9answers
11k views

Taxonomy term name as contextual filter for view

In D7 I was able to filter a view according to a taxonomy term name taken from the URL. An example would be this URL http://www.gbyte.co/tags/drupal-planet/rss.xml "drupal-planet" would be converted ...
15
votes
4answers
5k views

How do I filter only the root terms in a vocabulary in a view?

I have have a vocabulary structured as so: Root Alpha Term Alpha 1 Term Alpha 2 Subterm Alpha 1 Root Beta Root Gamma Term Gamma 1 Term Gamma 2 How do I filter the view to show only the root ...
15
votes
7answers
3k views

Exporting Taxonomies to code

I'm looking for a way to export Taxonomy vocabs and their associated terms. So far I've found and tested: Taxonomy Export -- Exports to code using features but doesn't import. http://drupal.org/node/...
14
votes
9answers
32k views

Get taxonomy terms

I wanted to retrieve taxonomy terms from a certain vocabulary in Drupal 8. Apparently I can still do it using taxonomy_get_tree but it's deprecated. I now have to use TermStorageInterface::loadTree ...
14
votes
5answers
8k views

how to separate taxonomy hierarchy in pathauto with slashes

Pathauto seems to have a different way of aliasing taxonomy hierarchy. From Taxonomy Menu: Classifieds > Cars > Aston Martin > DB9 Coupe Classifieds > Jobs > Accounting What I want is something ...
14
votes
1answer
23k views

Related nodes by taxonomy term in a view block [closed]

In Drupal 7, I've got a content type called "Asset" with a taxonomy field called "Category". All I need is a Block on the Asset pages that looks at the current node's Category term(s), finds all other ...
14
votes
3answers
8k views

How do I show only 3 of the latest posts for each term in a view?

With the help of another question: Show newest nodes for each taxonomy term in Views I have been able to create the view I require, except that it displays all posts for each term (grouped by term)? ...
13
votes
3answers
28k views

How to show the parent and child taxonomy term?

I have a vocabulary like this: Parent 1 Child 1 Child 2 Child 3 Parent 2 Child 1 Child 2 Now I would like to use a view to create a list of a Parent term with its Child terms. I try to do this ...
13
votes
1answer
4k views

Programmatically create taxonomy term

How would you programmatically create taxonomy term? I wish to bulk create some in a custom module.
13
votes
2answers
3k views

How to Disable new terms (free tagging) with Taxonomies?

I have a "term reference" field, in a form that uses an auto-complete widget. I want to limit user input to terms in the vocabulary only, and output a message when a user tries to enter a non existing ...
12
votes
4answers
4k views

When to use list(text) or taxonomy?

This may be a silly question, but I'm curious what the benefit is of using a list (text) multiple select field over a taxonomy term reference field. They both seem to fill roughly the same function of ...
12
votes
5answers
8k views

How can I inject a taxonomy menu as the sub-menu of a standard menu item?

I have a main menu, with a top-level structure similar to the following: Home - Categories - Something Else - ... - Contact Each of those top-level links goes to an appropriate node page. I have a ...
12
votes
2answers
17k views

How do I get a list of all taxonomy terms assigned to a node?

I have a node and want to get all the taxonomy terms assigned to the node. In drupal 6 I could use $node->taxonomy and the taxonomy_* functions but these don't exist in drupal 7.
11
votes
3answers
23k views

How do I get the taxonomy term name of the current taxonomy term page.tpl.php?

Im on d7. Im trying to get the taxonomy term name of the the taxonomy page that I am on. Since Im not on a "node" page, I can't get it by the $node->tid. What should I do? Thanks.
11
votes
1answer
4k views

Entity reference vs. taxonomy

Let's say I have a team, which has members. I have a content type for team and a content type for individual team members. Let's say there are also other relationships, for instance teams can belong ...
11
votes
2answers
20k views

How do I load taxonomy terms? [duplicate]

I want to load taxonomy terms by tid, but I didn't found how. Only how to load taxonomy by name, but now I have term id and I need to get value of fields. I call this on public function build() for ...
11
votes
1answer
16k views

Use views to display taxonomy children terms from parent

I'm hoping there might be a solution to this, but I do not have too much hope after searching a bunch. Currently I have some articles that have terms associated with them and these terms are 2-3 ...
11
votes
5answers
5k views

How to get the taxonomy translated in URLs?

I have a bilingual site with localized taxonomy terms used as categories. I would like to achieve this: http://www.mysite.com/about/pageinenglish http://www.mysite.com/apropos/pageinfrench (A ...
11
votes
2answers
6k views

Converting Term names with special characters to Term ID's in Views

I have a view where I want to use multiple termID's as arguments. I want to use a term name from the url and convert it to a termID. I've managed to do this easily enough and it works with simple 1 ...
10
votes
10answers
15k views

How to delete all terms from a vocabulary (bulk delete)?

I have a large vocabulary, and admin views does not yet work for taxonomy. Taxonomy Manager does not do this as well. Are there any options for bulk term delete?
10
votes
5answers
18k views

How to get the translated term name by tid?

I'm looking for a working method to get the translated term name by tid. The following code returns the original term name but not the translation. global $language; $lang_name = $language->...
10
votes
7answers
13k views

Display comma-separated list of taxonomy terms?

Drupal 7. In my node.tpl.php, I want to print out a list of taxonomy terms (the taxonomy is called "channels."). If I use: <?php print render($content['field_channel']); ?> It works, ...
10
votes
2answers
4k views

Generate only parent taxonomy terms in a block

I need to generate a menu for parent taxonomy terms. How would I go about doing this? I'm also looking to generate these terms in a block. I have a views set up right now that displays just all ...
10
votes
3answers
7k views

Retrieve translated taxonomy term in current language programatically

How do I retrieve a specified taxonomy term translated (if translation exists for this term) from the current language context programmatically with D8?
10
votes
3answers
6k views

Re-write the output of taxonomy_term_page() without hacking core

In Drupal 7, taxonomy.pages.inc contains the taxonomy_term_page(), which places a <div class="term-listing-heading"> around the taxonomy heading output. How can I re-write the output of ...
10
votes
5answers
9k views

Drupal 7 - Suppress output of nodes on Taxonomy Pages

Is there a way to suppress the output of nodes on taxonomy pages, without having to install a module (i.e. just in template.php)? Nodes tagged with a taxonomy term appear on the "Taxonomy Index page" ...
10
votes
3answers
7k views

Drupal 7 views contextual filter (taxonomy: summary display), displaying a readable term-name instead of term-id

Within my view, I'm using a contextual filter—with a default "summary output"—to filter my results by taxonomy term. The problem is that the summary-result is grouped by a listing of taxonomy term-id'...
10
votes
3answers
281 views

Converting my project's requirements to drupal's concepts

I am building a website for a client and I thought that Drupal is the best choice due to the plethora of choices that it gives me. However, this vast amount of choices made my job a lot harder. Let me ...
10
votes
5answers
4k views

show amount of results for exposed filter

I have a couple of exposed filters to filter the content in my view. Most of them are taxonomy terms, now i would like to show how many nodes are tagged with that term behind the taxonomy term. ...
9
votes
5answers
5k views

What are the advantages or disadvantages of using reference based modules instead of taxonomy module?

I wonder how to decide either to use core Taxonomy module or Entity Reference module? I didn't use Entity Reference module before but I've used the taxonomy module (and some related modules) on 10-15 ...
9
votes
3answers
9k views

Check if current page is taxonomy term

How can I check if the current page is a taxonomy term page, similarly to what done with the following code used to check if the current page is the front page? if (drupal_is_front_page()) { // The ...
9
votes
2answers
5k views

Configuration export/import doesn't work

I did a drush config-export staging on a local version of my site then a drush config-import staging on the server. It imported all the taxonomy vocabulary but no terms. I also tried it via the UI (...