[Closed] When URL parameter is blank or missing, Views returns all possible results

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will answer your ticket in about 7.97 hours from now. Thank you for your understanding.

This topic contains 1 reply, has 2 voices, and was last updated by  Shane 2 months, 1 week ago. The support staff assigned to this topic is Shane.

Viewing 2 posts - 1 through 2 (of 2 total)
Author
Posts
#576941

This page includes multiple views that are only supposed to return when their State custom field matches the URL parameter state= -- but when I just load the page as is, it returns every possible content item. What I want is for it to return nothing when there's no URL parameter -- how can I do this?

hidden link

vs.

hidden link

#576964

Shane
Forum moderator

Supporter languages: English (English )

Supporter Timezone: America/Jamaica (GMT-05:00)

Hi Jesse,

Thank you for contacting our support forum.

There is only one way I can think of resolving this is to use our [wpv-conditional] shortcode to evaluate the url parameter to check if its empty.

We will need to use a combination of our shortcodes to achieve this.

https://wp-types.com/documentation/user-guides/conditional-html-output-in-views/using-custom-functions-in-conditions/

And
https://wp-types.com/documentation/user-guides/views-shortcodes/#wpv-search-term

So how we will do it is like this.

<wpv-loop>
[wpv-conditional if="( '[wpv-search-term param="state"]' ne ' ' )"]

view contents here.
[/wpv-conditional]
</wpv-loop>

This will allow you to not display anything if there wasn't a state specified.

Please let me know if this helps.
Thanks,
Shane

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘[Closed] When URL parameter is blank or missing, Views returns all possible results’ is closed to new replies.