Hi
I have a very simple view that loops over categories (custom taxonomy) to which I pass an ID as URL parameter (cid) in order to get the passed ID taxonomy title. It works fine if the ID exists, but if I pass a not existing code (eg: 000) it returns the title of first ID in the taxonomy instead of whatever I enter in the [wpv-no-items-found] section (I'd like to display nothing). It looks like it doesn't go into the [wpv-no-items-found], can you explain why ?
thanks
Regards
Nicola?
You are saying that if you pass an ID that doesn't exist into your View then it still returns a result ?
Yes. I found out that if you pass a string like xxx it returns nothing (ok) but if you pass a numeric id like 0000 it returns whatever first category item depending on the chosen sort criteria. To solve this case I can pass xxx, but in other cases one might need to pass a numeric value.
You already have access to my site, use this page to test: MY_SITE/test-title/?cid=000000 and you can use the last page starting with zzz to list the category codes.
I didn't test it with other views, but this one is very simple.
Thanks
Regards
Nicola
Hi Shane
referring to what above, I checked that on the live page I cannot pass xxx, I do need that when the parameter isn't passed the view returns nothing, otherwise other selections would go belly up.
I have tried this solution:
[wpv-conditional if="( '[wpv-attribute name='catg']' ne '' )"][wpv-view name="pseudoarchive-title-cat"][/wpv-conditional]
[wpv-conditional if="( '[wpv-attribute name='xtag']' ne '' )"][wpv-view name="pseudoarchive-title-tags"][/wpv-conditional]
[wpv-filter-meta-html]
[wpv-layout-meta-html]
but the condition is not working, the two titles are both displayed, the one passed by parameter is correct, the other one gets the first item in the taxonomy instead of returning nothing. Consequence is that it shows two titles instead of one ! Can you suggest a different condition ?
Thanks
Regards
Ooops sorry, I made a mistake, this is the updated code:
[wpv-conditional if="( '[wpv-attribute name='xtag']' eq '' )"][wpv-view name="pseudoarchive-title-cat"][/wpv-conditional]
[wpv-conditional if="( '[wpv-attribute name='catg']' eq '' )"][wpv-view name="pseudoarchive-title-tags"][/wpv-conditional]
[wpv-filter-meta-html]
[wpv-layout-meta-html]
CATEGORY VIEW
{!{wpv-conditional if="( '{!{wpv-search-term param='cid'}!}' ne '' )"}!}
{!{wpv-view name='pseudoarchive-title-cat'}!}
{!{/wpv-conditional}!}
TAG VIEW
{!{wpv-conditional if="( '{!{wpv-search-term param='xtag'}!}' ne '' )"}!}
{!{wpv-view name='pseudoarchive-title-tags'}!}
{!{/wpv-conditional}!}
If you take a look at my testing here
/test-title/?cid=144
You should see it working. The correct shortcode to use to get the value from the URL is the [wpv-search-term]
Finally to clear up the issue with the "no results found" section not showing when a URL parameter isn't providing is that views will default to displaying the content when no filter parameter is provided.