Drupal 7 - Display articles using taxonomy in URL? - drupal

I'm having a hard time with this Drupal 7 question.
I have a view which lists articles. Each article has a category, which is a entity referenced taxonomy term. When I visit a URL, my taxonomy should match something in the URL. For example, if I go to news/localnews, there's a taxonomy option whose value is news/localnews.
What I'd like to do is display only articles which contain the same taxonomy term as in the URL. I have no idea how to do this and I've been working on this problem for about 5 months. Any help would be greatly appreciated!
All I really want to do is add a block (or several, on most pages) which just displays a list of articles which match the taxonomy in the URL.
Can this be done? If so, how?
Thanks!

In your views, on the Advanced tab, add new Contextual filter
Choose Content: Has taxonomy term ID (with depth)
Set Depth to 1 and select Provide default value with Type : Taxonomy Term ID from URL

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 views to display nodes with same taxonomy term

I have an organization page with a taxonomy field. I'd like to create a view of news pages tagged with the same taxonomy term used in this field. I've read and watched several tutorials on relationships and context filters but none of them have helped me create this view. How can this be done?
I'm using Drupal 7.5
The trick is to use default value of contextual filter:

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

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.

How to create taxonomy term count block?

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.

Drupal 7 list users with taxonomy term using Views and Pathauto

I am attempting to create a taxonomy term page to display users tagged with a vocabulary "expertise" and not having much luck.
I'm using pathauto to alias the taxonomy term pages with the following pattern: [term:vocabulary]/[term:name].
I then have a Views page for Users with the path set to /expertise/% and a contextual filter on "User: Expertise" (my taxonomy term field). The filter takes the default value of "Taxonomy term ID from URL" and validates as a taxonomy term from the "Expertise" vocabulary.
However, if I then go to (for example) /expertise/php I appear to be getting the standard Drupal taxonomy page rather than the View page setup and see no user results.
Any ideas how I can fix this? I have several taxonomies in use for both nodes and users so need to be able to distinguish between the vocabularies using the aliasing described above.
That's what a contextual filter does... it takes over every page.
I'm confused as to why you aliased the term pages at all... it seems like you don't want to dispaly them, so why not just forget about the alias and set the view page to the url you want it to be at?

Resources