3 of 3 added 699 characters in body

Views block to list all terms in homepage and list child terms in taxonomy page

I have a views block of taxonomy terms.

I want the block to display all terms when it is on homepage, and to list child terms when it is on a taxonomy page (contextual filter: Taxonomy term: Parent term:Taxonomy term id from URL).

example: I want to create a block to list news categories(first level only) when it is on home page (I can do this by using contextual filter Taxonomy term: Parent term-> fixed value=0). and when the block is in a taxonomy page I want it to list the child terms of the current taxonomy (can be done using contextual filter Parent term:Taxonomy term id from URL).

can I have a single views block to do both, without having to create two blocks, one for home page and another for taxonomy pages.

A similar block that I want to create (I don't know if I need to create a separate question or it is just related to the previous one).

I have a views block of content with taxonomy term.

I'm trying to create a slider(views block) that displays the latest 5 news of each taxonomy term from url, I can do this using a contextual filter: Content: Has taxonomy term ID (with depth) then provide default value: Taxonomy term id from URL, this works fine in taxonomy pages.

what I need is, when the block is on front(home) page I want it to display the news from all taxonomy terms (neglecting the contextual filter). I can do this by creating another views block without the contextual filter, but can I achieve this with a single views block?

sorry if this sounds confusing, and thanks for help.


An example for the taxonomy view:

I have a taxonomy vocabulary "Categories" consists of parents and children

  • Politics:
    • Local
    • International
  • Sports:
    • Local
    • International

I have a views block that lists the terms of a vocabulary "Categories" (only the first level)

  • Politics
  • Sports

I need the block to list the top level terms when it is showed in Front page(Homepage) and to list the child terms when it is showed in Taxonomy term pages

Ex: when it is in Politics page I need it to list only the children of Politics

  • Local
  • International

I want to achieve this with the same views block