Questions tagged [taxonomy-terms]
"Taxonomy" refers to Drupal's content classification mechanism, organised into vocabularies and terms.
344
questions
107
votes
2answers
68k 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 ...
33
votes
5answers
31k views
Node count for taxonomy terms
How can I display the node count values for taxonomy terms 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 ...
14
votes
3answers
29k 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 ...
9
votes
2answers
15k 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 ...
7
votes
4answers
18k 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.
4
votes
3answers
665 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
19k 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->...
23
votes
10answers
50k 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
...
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
5k 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 ...
5
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 ...
4
votes
2answers
2k 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 ...
3
votes
1answer
600 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 ...
13
votes
2answers
18k 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.
21
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, ...
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.
...
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 ...
5
votes
4answers
6k views
Create taxonomy terms on the fly
As far as I know, the way to create a taxonomy term is having to go into the taxonomy module and creating on there, and THEN assigning the term to the node.
Is there a way to create taxonomy terms on ...
13
votes
2answers
4k 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 ...
0
votes
2answers
1k 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
--...
28
votes
5answers
22k 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.' ...
21
votes
6answers
35k 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 ...
14
votes
5answers
9k 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 ...
7
votes
2answers
6k 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
7k 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
6k 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 ...
6
votes
5answers
4k 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
2answers
3k 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 the taxonomy page template?
It's easy to accomplish it when the image is in a node. The following code works for images, ...
7
votes
3answers
4k views
Display taxonomy field in node display
I created a vocabulary where terms have an image as additional field.
I want to show the image instead of the term name in the node page. How can I do this?
In Drupal 6.x, I would load the term and ...
3
votes
2answers
586 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 ...
-2
votes
1answer
85 views
Creating content with a hierarchy
I want to create hierarchical content in Drupal, and I am trying to decide between nodes and terms.
What I want to do
I want to implement books.
Each piece of content may be a book (containing ...
22
votes
10answers
17k 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 ...
38
votes
6answers
28k 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 ...
8
votes
1answer
13k 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 ...
13
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)? ...
10
votes
20answers
16k views
How do I 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 other options for bulk-deleting taxonomy terms?
5
votes
1answer
804 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
3k 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 ...
11
votes
3answers
32k views
How can I get the taxonomy term name from a term ID?
I'm trying to get a taxonomy term name by term ID. According to another post, I should load the term first:
$term = \Drupal::entityTypeManager()->getStorage('taxonomy')->load($tid);
But then I ...
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['...