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
67k 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
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.
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 ...
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 ...
6
votes
4answers
17k views

how to get the translated taxonomy term programmatically? [duplicate]

I have tried this $term = taxonomy_term_load($tid); and this: $term = i18n_taxonomy_localize_terms(taxonomy_term_load($tid)); Both return the default language (English) term I am using D7.
8
votes
2answers
14k views

How do I get a block to use a URL to configure a contextual filter?

Blocks do not have paths so how can I pass a context to the block to get the correct results for a page? I am new and do not have enough reputation to answer my own question for eight hours (Go ...
4
votes
3answers
655 views

How to prevent access to Views-only content?

When I'm developing sites in Drupal, I create various content types and taxonomy vocabularies that I use with Views to build displays. I might not ever want the nodes to be viewable in their own right ...
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->...
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 ...
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 ...
14
votes
9answers
33k 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 ...
4
votes
1answer
6k views

Get list of taxonomy terms for current node through Views

I've been trying this for awhile, and I keep finding answers that are close - but not quite. If there is a node with taxonomy terms attached to it, I want to create a block in Views that I can place ...
3
votes
1answer
572 views

How to check for product taxonomy term in Rules actions (Ubercart)

I am using Drupal 7 with Ubercart. I am trying to configure to send an email when customer makes a purchase of a product mapped to one particular taxonomy term. I tried adding actions in a custom ...
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.
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 ...
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, ...
2
votes
2answers
5k views

Taxonomy term pages with multiple views

I currently use only one view with path taxonomy/term/% and without any vocabulary verification. However, I would like to create two views: news and products (to implement different themes) linked to ...
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. ...
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 ...
4
votes
2answers
1k views

Selecting taxonomy term in article and showing all articles titles associated with this term

I have a content type article and when editing an article there should be a field where you can select a taxonomy term of a specific vocabulary. When viewing the article it should show a list of ...
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.' ...
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 ...
32
votes
5answers
66k 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'...
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 ...
6
votes
1answer
5k views

How do I theme a taxonomy term page?

I am working on Drupal 8, trying to get a page template for each vocabulary. I have tried using hook_theme_suggestions_HOOK_alter() to achieve this, but I was not able to do it. I tried using Devel ...
5
votes
5answers
6k views

How to show translated taxonomy terms in a view?

I have used the Views module to create a view of taxonomy terms. The taxonomy terms are translated in the Greek language also (apart from English), using the typical i18n modules. But when I switch ...
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 ...
6
votes
2answers
6k views

Group nodes by terms

How do you group a list of nodes by the taxonomy term? e.g. Term 1 --- Node 1 --- Node 3 --- Node 7 Term 2 --- Node 6 --- Node 9 --- Node 12 I have tried creating a view with "Node" and "Taxonomy ...
5
votes
1answer
10k views

Taxonomy in Contextual filters for Views

I am new to drupal and currently I am exploring the Views module. I have a dummy website for a toy shop to learn on. I have created taxonomy as follows where "Category," "Ages," and "Brand" are ...
5
votes
4answers
3k views

Entity Reference: Filter by an entity reference view not working as expected

I am attempting to get a taxonomy reference field select widget that shows a list of taxonomy terms, including some extra data from their fields. I have attempted to use the "Reference method" = "...
4
votes
3answers
10k views

Taxonomy menu with custom path for taxonomy terms

I am trying to make a taxonomy menu using the Taxonomy Menu module with a custom path for the taxonomy terms. Instead of /taxonomy/term/tid I want /proj/!tid (or ultimately /proj/!term-name but I'll ...
3
votes
1answer
3k views

Views (Search API): Search taxonomy parent and display all children

Problem I have a country taxonomy field. The top level is continents then below that countries: Asia --China --Thailand Europe --France --Germany I'm using search API (with solr backend) to index. ...
3
votes
1answer
720 views

Add class to term-reference output

I'm trying to add a simple class to a link outputted via print render($content['field_tags']). I'm using the Bootstrap theme. These are the approaches I've tried so far: Hooking into ...
2
votes
2answers
2k views

How to display a taxonomy term's immediate children on its page?

In Drupal 8, how can I display a taxonomy term's immediate children on its page? For example, I have a hierarchical taxonomy vocabulary like this (simplified): Animals --Fishes ----Blennies ------...
1
vote
1answer
1k views

print custom image field for taxonomy page (page--taxonomy.html.twig) template

How do I load an image from a taxonomy custom field into a custom location on my taxonomy page template? Its super easy to accomplish the image is in a node by calling the twig tag for that field. I ...
3
votes
2answers
544 views

How to correct my rule to prevent duplicate taxonomy terms to be created?

This is a followup of my question at How to create a rule to combine the terms of 2 fields to create a new term and store it in a 3rd field?. How can I prevent that each time a node is viewed, it ...
0
votes
2answers
3k views

Views: How can I show a list of users who have a taxonomy term attached via a term reference field?

I'm using the views module's built-in "Taxonomy term" view which overrides the way Drupal displays taxonomy by default and makes it accessible to views. However, this only works for content, not ...
0
votes
2answers
803 views

On a content page that references a taxonomy term, how can I display only content that references that taxonomy term's immediate children?

In Drupal 8, I have a hierarchical taxonomy vocabulary called "Living Things" containing these terms: Animals --Fishes ----Blennies ------Yellow Blenny ------Green Blenny ----Gobies ------Blue Goby --...
17
votes
9answers
12k 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 ...
8
votes
1answer
12k views

filter with taxonomy-term-alias instead of term-ID?

I've my view filtered by taxonomy term ID. http://aelasoca.cat/web/ (in the main menu I've links to taxonomy ID's 3 to 8). How can I filter with the taxonomy term alias instead of it's ID ?? (not ...
32
votes
6answers
21k 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 ...
5
votes
1answer
751 views

Taxonomy Terms node count of different content type

Hi I have a issue for which I searched everywhere but not getting any solution, I have two content types Store and Deals with the following fields Store is having the fields 1.Store-title 2.Logo 3....
4
votes
1answer
7k views

How can I display a taxonomy term's parent ID in Views?

I am using a JSON plugin to Views to output taxonomy terms as a JSON object for Javascript manipulation. I was to be able to include the parent ID in this output. In view I see "Taxonomy term: Parent ...
4
votes
2answers
2k views

How to create a list of similar nodes in Drupal 7/Views 3

I face a rather common problem of displaying a list of nodes similar to current one. Similar node is defined as one having at least one taxonomy term that current node has. There are few solutions ...
2
votes
2answers
2k views

Email users on node creation based on taxonomy reference

I have 2 taxonomy vocabularies (town and topic) which are referenced on both a user and a node. When a node is created, I need to email all users who are referencing any of the terms referenced on the ...
5
votes
5answers
6k views

How to modify taxonomy term path in the page render array?

I'm trying to change the path of a term before it's displayed on a node page. I'm using this preprocess function in template.php: function bartik_preprocess_node(&$variables) { $variables['...
4
votes
2answers
1k views

How do I group taxonomy by hierarchy, not node?

I am using Drupal 7 and Views. I'm trying to use the generic Taxonomy/Term view and get a grouping I don't want. I want this: Taxonomy 1: Node A Node B Taxonomy 2: Node B Node C (Notice Node B ...
4
votes
2answers
2k views

Programmatically add a taxonomy term as entity reference in a custom entity

I'm really struggling to add a taxonomy_term as an entity reference to a custom entity I've created programmatically. Here is my configuration based on BaseFieldDefinition (the name of the vocabulary ...
3
votes
2answers
3k views

How to do a custom taxonomy breadcrumb

I'm using Drupal 8.3.0-beta1 and I need to write a custom module to customize breadcrumbs in some cases. On of this cases consists in customizing the breadcrumb in path taxonomy/term/% but with my ...
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 ...