How to create taxonomy term count block? - drupal

I have a blog in Drupal 7 where the blog content type has a multi-select box (select drop-down box) for tagging that uses a specific taxonomy vocabulary. As such, any blog entry can have multiple tags from the vocabulary by control-clicking the terms. What I need is a block that lists the terms with the count of the number of times the term has been used
Ex:
Drupal (21)
Views (15)
Panels (18)
I also need each list item to link to a page that lists the blog titles associated with the term. I thought the first part would be simple using views with aggregation but, so far, no luck. Any idea how to do this?
Thanks

Create Taxonomy Views.
Add relationship to the node.
Enable grouping (or "Use aggregation" toggle in D7, then set the "Aggregation Settings" for each field)
Add new field 'Node: NID' and set Group type to: Count
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.

Selecting multiple taxonomy terms in blog Drupal 7

I've just started learning Drupal 7 and while I was creating a blog I wanted to give it a relation but it must be related to multiple articles through taxonomy terms.
In the Blog content type, I created a relation field, set the Field Type to Term Reference and Widget to Check boxes/radio buttons.
Here is a snapshot http://varunsharmak2.com/blog-content-type.png
Now when I create a blog entry, it shows all the Taxonomy terms as radio buttons in Relation section.
Here is a snapshot of it. http://varunsharmak2.com/relation.png
I want checkboxes in place of radio buttons.
How can I get check boxes?
When you edit that field there should be an option to select how many tags can be selected? Default is one, but you can select 2,3... and finally unlimited. That field is drop-down field. Select unlimited.
Your second screenshot is not working btw.

Taxonomy Views filters Intersection

We have the following picture:
We have 4 taxonomy terms inside same filter and 2 articles: one tagged ideea&news and the other one ideea&business.
Now when you select ideea&news filters you get both articles as results. How can i change that, so i get the intersection between the selected taxonomy terms (so to have only results containing BOTH ideea&news)?
From your view admin page, under Advanced section. Click on Query settings: Settings and make Distinct checked.
Hope this works.

So Many Tutorial Guides, But How Can I Filter A Drupal 7 View To Show Nodes With A Taxonomy Term?

Although many post exits for this topic, no one seem to guide the user on how to go about this feature. I need to filter a view block such that it displays nodes with specific taxonomy terms. I have a taxonomy vocab called Sections containing terms like Analysis, Sports e.t.c and my Article content type has a filed tagging them with the terms. In other words, Article nodes are tagged with term(s) from the Sections vocab. I just need a way to display a block, with say nodes tagged with Sports
If you have followed any D6 tutorials, the major change is that taxonomy terms are now tagged as a field.
So create the View on Node table, and add fields as you want. Then, add a filter to the field's name that you used to tag terms in the Sections vocabulary.
You will be given a multi-select list to choose which terms should be filtered.

Drupal: How to build a categorized menu tree

I need to build a custom menu structure based on taxonomy terms. The Problem is that only the first level should be a Taxonomy-Term. All nested items must be a node. Each node can have only one Term. And Terms without any nodes associated should not appear in the menu.
How could i do that? Any suggestions for me?
Example Menu:
TERM-1
Node-1
Node-2
Node-3
TERM-2
Node-1
Node-2
...
Thank you.
Edit
I need this for a photgrapher website. Each term is a global categorie like Portraits, or Artists. Categories are only a wrapper for galleries. Based on the example Menu above a possible structure could be something like this:
Series (Term)
Bodies (Node:Type->Gallery associated with Term:Series)
Classic Cars (Node:Type->Gallery associated with Term:Series)
Surroundings (Node:Type->Gallery associated with Term:Series)
I would suggest doing this with a view. You will want to create a view which lists nodes, and set the view to group by taxonomy term.
So, create a new view (admin/build/views/add)
View Type: Node - name the view, and proceed to next page.
Filters
Node: Published - yes
Node: Type - Gallery
[optional] Taxonomy: Vocabulary = Series - this will hide galleries which have not been assigned to a Series.
Fields - delete the labels for fields as you add them
Taxonomy: All Terms - you could also use Taxonomy: Term, but if you have more than one taxonomy, such as free tagging, then those free tags would show up too, so All Terms is better because you can limit the vocab.
check the checkbox - Exclude from Display
limit terms by vocabulary - Series
Node: Title
check the checkbox - Link this field to its node
Basic Settings
Style: Unformatted
click on the cog to change settings and set Grouping Field to Taxonomy: Term
Items to Display : 0 - since you do not want a pager, you probably want to display all the results.
Sort Criteria - you will be adding two sort criteria...
Taxonomy: Weight - this controls the order for the groups - you will have to set your taxonomy term weights in the taxonomy administration area. (You could also just sort it by Taxonomy: Term if you want the terms to appear in alphabetical order.)
Node: Title - this controls the order for the nodes within each group.
Taxonomy menu trails solves this problem.

Resources