Thanks a lot Luo!
We're almost there...
Yes, these are custom types. If you still need the DB dumb, I'll try to provide it to you (don't have access to the server right now)...
I have modified slightly your code:
[wpv-conditional if="('[wpv-post-taxonomy type="category" format="slug"]' eq '[wpv-attribute name="termslug"]') OR ('[wpv-attribute name="termslug"]' eq '')"]
[wpv-post-link] <span class="feuillet">[wpv-view name="organe-feuillet-relationnel"]</span> ([types field='foyer-hamer'][/types])
[/wpv-conditional]
That way, the second level (which is a second view and which doesn't provide a termslug) is also displayed...
The only problem is (since nothing is ever easy) that sometimes an entry belongs to more than one taxonomy term (hopefully always on first level...). In that case, it's not "eq" to, say 'orl', but I guess it's "eq" to 'orl, sens' and sometimes more than two I guess... So, I tried to use "gte" or "lte" instead, but it doesn't work... Is there a way to say "includes" instead of "equals" (because my understanding is that "equals" must be identical, therefore if there are more terms, it's not equal anymore)?
HERE'S THE SOLUTION I CAME WITH, but it's really not pretty, so if you have a better solution, I would like to see it...
In the View that outputs the result, I replaced all your code by a script that I had to put directly in the output (i.e. not in the JS section), since I need to use a document.write:
<script>
var flag = false;
var slugCat = '[wpv-post-taxonomy type="category" format="slug"]';
if (slugCat == '') {
flag = true;
} else {
var indexCat = slugCat.indexOf('[wpv-attribute name="termslug"]');
if (indexCat >= 0) {
flag = true;
}
}
if (flag) {
document.write('
[wpv-post-link] <span class="feuillet">[wpv-view name="organe-feuillet-relationnel"]</span> ([types field="foyer-hamer"][/types])
');
}
</script>
I needed to remove all the spaces and check the "Disable the wrapping DIV around the View" from the [wpv-view name="organe-feuillet-relationnel"] that it's calling, because it was breaking the JavaScript.
So, like I said, now it's giving me the expected output (see screenshot), but the code is not too pretty...