2

Is it possible to show only Views content that passes a text in a given field?

For example, I have 3 content types and each content type has an identifier field (text field) which is hidden to the public.

So on my main content type, which is an information page, I list information about a football team. And then in the second content type I create results and a review of a match. And I display them as a view on the football team page (content type 1).

Content type 1 has a unique identifier, for example a text field saying "barcelona001". And this is the same on the "match results" content type field. How do I let views filter that, so that it only shows the right information?

If I can do this with a text field that would be great since I need to use a lot of taxonomy fields already to make it all work.

Any suggestions?

1
  1. Create a new view that displays content of all types.

  2. Add your text field to 'Filter Criteria'. It looks something like this...

    Content: My Text Field Name (field_my_text_field_name)

  3. Select 'is equal to' and enter 'barcelona001' to the 'Value' field.

  4. Press Apply (twice).
  5. If you have the value already on some contents text field it should now display a list of matching content in the preview.

You would probably also benefit from contextual filters. Remember first to remove the field from 'Filter Criteria' if you added it earlier.

  1. Choose 'Advanced' from the Views settings page. It should now show you 'Contextual Filters' setting.
  2. Add your field.
  3. Click Apply.
  4. You can now write 'barcelona001' in the 'Preview with contextual filters' field.
  5. It should display the result in preview.
  6. See the 'Path' value in the views settings. You can go to that path and put whatever value you have used in the textfield after the path like this .com/my-page/

I hope this helps!

  • Hey thanks for the reply! the second option is what I was looking for! and it somewhat works but not entirely. I am displaying it in a panel so I need it to filter by the text field and show all results that come up using the same filter. Filter is also on the panel and in the content added. Is there a workaround for this? – romant Dec 13 '13 at 14:36
  • Use the first option (Filter Criteria) and select expose filter. – jiv-e Dec 14 '13 at 22:10

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.