1

I want to create a view page with the city events /attractions ... I want to categorize them as family , kids , outdoors etc. So that when a user clicks on a particular category they see the events/attractions listed under it.

How do I do this using Drupal 7 and views?

3
  • When you say "they see the events/attractions listed under it", you mean the events are presented inside the same view? Like an accordion like effect? Or a new page load with the list of events/attractions for the selected category? There are ways to do either of these. Mar 20, 2016 at 16:41
  • Your question is very vague. You need to describe to us how your content is structured. Mar 21, 2016 at 5:15
  • Hi Stefanos ....its a new a new page load with the list of events/attractions for the category. Thanks
    – Mia
    Mar 21, 2016 at 13:38

2 Answers 2

1

Another way of doing this is with Contextual filters

-Create a view display Page (Block also works)

-Add Contextual filter Content has Taxonomy Term ID

-Leave When the filter value is NOT in the URL as Display all results

-On When the filter value IS in the URL or a default is provided check 'Specify validation criteria' and choose the vocabulary that has your events categories, leave filter type as 'Term ID'

Now when you hit the page url example.com/events it will list all the events from all categories

When you hit example.com/events/1 it will only list events from the category that it's term ID is 1 (say family is id 1 and outdoors is id 2, it will show all events categorized as family)

You could also make it filter by more than one term with other configurations options, and create URL aliases so your url becomes example.com/events/family

1

In the Filter Criteria add a filter Content: Has taxonomy term .

Choose the Vocabulary with your category. In the next step check Expose this filter to visitors, to allow them to change it . Set the Label as you want and "Apply".

Anyway, try to be more specific in your question if you want a better answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.