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.
Related
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.
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.
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.
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.
I'm confused about the proper way of structuring the content. For example there's a fashion blog. There's a parent category "fashion news" with children categories: "news" and "collections". I'd like to create a database of models, brands and photographers. For each model (brand / photographer) there shall be an individual page like site.com/models/lara-stone. This page includes basic description, photo gallery (this should be implemented just as a post in WP) as well as special fields like "weight" and "height" for models (custom post?) and below all this there shall be all posts under category "fashion news" / "collections" related to the model (brand / photographer). On the main category page "fashion" I would like to have lists of brands / models / photographers. When creating a new blog post, the author should be able to choose the right model / brand / photographer. How do I structure all this stuff?
ever heard of paragraphs.. on topic:
Make a custom posttypes of content that has it's own fields/properties.
Like models you will have to add custom fields for height and weight.
For properties that might have multiple values consider tags/categories like
a model works both for brand X and Y
Then on the category page of brand you can get all models.
I hope this helps you on your way.
Tip get a big paper/whiteboard and draw all relations/structure how you would like to have it regardless of restrictions a system gives you.