I would like a views contextual filter to only use the last argument in the url. Given the following taxonomy structure, I would want /term-a
to return Term A1
and Term A2
only (which works fine). However, if the url is /term-a/term-a1
I would want only Term A1a
to be returned, which isn't working, it's still returning Term A1
and Term A2
Within views, I don't see a way to use the last part of the path for the filter. I tried to remove the argument from the path and then use the following as a default argument:
$path = arg();
return array_pop($path);
Here is the sample term hierarchy:
- Term A
- Term A1
- Term A1a
- Term A2
- Term B
- Term B1
- Term B2
Just to reiterate what is returned:
The path /term-a
returns:
- Term A1
- Term A2
The path term-a/term-a1
returns:
- Term A1
- Term A2
The path /term-a1
returns:
- Term A1a