Drupal 7 - Add a wrapper around related nodes on Taxonomy term page - drupal

On a taxonomy term page, the taxonomy term info is shown first, followed by related nodes. I want to add a wrapper div around the related nodes (ex. class="related-nodes").
taxonomy-terms.tpl.php controls the display of the taxonomy term's fields, but I'm not sure how the nodes show up. I was thinking about making a node template for the taxonomy and doing something like render($content['nodes']). However, I'm not sure what the $content key would be for the related nodes.

One approach is to enable the Taxonomy term view display (is disabled by default).
In the view config, you can add classes by clicking in Settings of Format option.
Hope it helps.
Regards.

Related

Relating different content types in Drupal 7

I've just started learning Drupal 7 and I'm stuck on a problem.
I want to relate different content types using taxonomy. For example, how can I display blogs related to an article?
I know how to relate articles and basic pages but I don't know how can I relate blogs with articles?
Please help me.
Use reference field in blogs content type
like
field name is: related with
field type is reference
set reference type node
set node type is article
optional multivalued true
Now you have a relationship field in blogs
Now you can do every thing with this relationship
Hope this make sense
Thanks
You would create your taxonomy vocabulary and supply it with terms. On its own, this doesn't do anything, you need to add a field to each of your content types that are using this taxonomy.
If you go back to your content types, structure > content type > article. Here you would create a new field of type term reference. Inside the settings of the field you'd select your vocabulary and then also the widget eg. select list. You can re-use this field on the other content types where you want to share this vocabulary.
If you go back to your content for the types you added this field for and populate them with selections, when you view that page by default the term will appear as a link. If you click this link it will take you to a page view that will list all the other nodes that have that term form that vocabulary.
More information on taxonomies: https://www.drupal.org/docs/7/organizing-content-with-taxonomies/about-taxonomies
If you are creating a view and want to know how to pull in different tagged content there, I'd recommend reading this post which outlines the steps to do so https://drupal.stackexchange.com/questions/205921/how-do-i-show-related-content
The process:
Basic stages:
Create a “Content” view-block.
Add a contextual filter: “Has taxonomy term ID”.
Choose “provide a fixed value”.
(From type): “Taxonomy term ID from URL“.
Checking:
• Uncheck “Load default filter from the term page”. • Check “Load
default filter from node page, that’s good for related taxonomy
blocks”.
• Check “Limit terms by a vocabulary”. • Check your desired
vocabulary.
Select “Filter to items that share any term”.
Go down and check “Reduce duplicates”: This will several terms that relate to the same page – To appear. Only one will of them will.

Drupal 7 - Term reference field: how to add new term?

I have some texonomies in my Drupal website. Some of them have additional fields. I have some fields of type Term reference in my content-types.
When I am creating a new node of a content-type, I would like to have the ability to add a new term to the taxonomy while I'm filling the form of the Content-Type (with an "add item" link/popup...).
I can do that if I use Entity Reference fields, but I cannot using Term reference field. Could you help me, please?
Thanks
UPDATE: I installed "Taxonomy access fix" module (https://www.drupal.org/project/taxonomy_access_fix) and it allows me to set capabilities per each taxonomy based on user role. Now I only need to add a new term to a Taxonomy on a form level using Term reference field (I canno use autocomplete because I need the user to see all possible values like with a dropdown).
Any help?
If you change your widget to the autocomplete widget, it will let you add new values.
I agree with #Dark FlameS, in fact we are using the autocomplete widget for some of our students to add types of trees in the biology lab and they tag each with the scientific name.
And since we dont know these scientific terms, we let them add taxonomy terms to the list.
Slight difference however, we use the module Autocomplete Deluxe. Works like magic for us.
You are able to see what taxonomy terms are already available by clicking into the text area.
And as you type a taxonomy term, you will see what other terms are similar. If a tag is new, it will be added. one thing, dont allow them to delete your tags. We learned this the hard way.
See the image below on what it looks like as you add a tag.
Above is what you will see when you are adding the taxonomy field in your content type, this is after you install the Autocomplete Deluxe module
Above is What the user sees when they add or select a taxonomy tag.

Taxonomy image in Drupal 7

I've set up taxonomy in Drupal 7 called Colours. I've added some terms (red, blue etc) and added a colour image to each term.
In a content type I have added a term reference field, so my client can choose colours (the colours in which that product is available).
In Views, rather than listing the taxonomy terms on the node page, I would like instead to output the image associated with the taxonomy term.
Any ideas on how to do this? I've tried endless "output this field as" in Views but just can't get it to work. The only way I've actually got it to work is to upload images when adding content, but that's not ideal obviously.
In Drupal 7 you have to add the taxonomy under "relationships". Then the taxonomy images will appear as fields in the view.
I had the same issue, all I did was adding a new field called "image" to the taxonomy and inside the view I just called that field. its working well.
Your best bet is to create a View Template, and in the template you can look at the value in that field and load the appropriate image in its place.
Here's a guide on doing this in Views 2: http://www.group42.ca/theming_views_2_the_basics
Couldn't find one for Views 3

Drupal change display based on vocabulary

I need to have terms related to a specific vocabulary use a custom view I have set up.
For example: I have a vocabulary called "Book Categories" with terms under it such as Humor, History, etc. When navigating to a term page (taxonomy/term/7), I would like to display just the book title and a custom book-cover field. By default, Drupal displays node title, teaser, and links on all taxonomy term pages. The problem I am having is I would like terms that fall under the "Book Categories" vocabulary to use my custom view, and all other terms to use the default view.
Is there a way around this? Any help is appreciated.
You can clone default taxonomy view and change fields section as you like.
In PAGE SETTINGS->PATH remove "%" and add taxonomy number of your Book Category (like "7")
In contextual filter delete all filters.
This view then should override default view.
Hope this helps.
There is a new module called Taxonomy Views Integrator that seems like it does what you want to do. Try it.

drupal taxonomy

I have several different content type nodes (videos, image galleries, stories...) that I would like to categorize and create a top-level page that aggregates these nodes. So for example, the top-level page would have teaser thumbnails very similar to the front page view but of course filtered for that topic (like for instance automobiles, and motorcycles would have its own page, etc...).
What is the best way to accomplish this? Taxonomy? Views?
You would use both Taxonomy and Views.
Taxonomy would categorize the content, and Views would allow you to configure the display however you like.
One possibility is having an Argument of a taxonomy term, (example, /path/path/taxonomy-term/index.htm) where taxonomy term is a passed URL argument. This would filter all content to that term.
You could also just rely on the taxonomy system, where content resides at /taxonomy/tid, but I don't think you get much control of the output that way.
You may also want to look into a module like Taxonomy VTN for a drill down list of taxonomy:
http://drupalmodules.com/module/taxonomy-vtn
There are lots of ways to approach this. Personally, I would use Views.

Resources