Skip Navigation

[Resolved] Filtered results

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 5 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#1143623

How can make this work. Here is what I would like to do:

1 - per custom field - not show any post without an image url in that field
2 - per custom field - not show any post with a specified placeholder image in that field
3 - per custom field - not show any post with an 'N' in it.

#1143628

Hi,

Q1) per custom field - not show any post without an image url in that field
I assume we are talking about a custom image field, if it is, you cam add a filter in your view, filter by the image field isn't empty, for example:

"my-image" != ''

see our document:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/#comparison-function
!= Single value Checks if the custom field value doesn’t match the exact compare value

Q2) per custom field - not show any post with a specified placeholder image in that field

Same as above, you can add a filter, fitler by that field don't have specific codes, for example:

"my-field" NOT LIKE "some text here''
See above document:
NOT LIKE Single value Checks if the custom field value is not similar to the compare value, using MySQL NOT LIKE operator

Q3) per custom field - not show any post with an 'N' in it.
Same as above:
"my-image" NOT LIKE "N''

For your reference.

#1143988

1 - are you suggesting that the filter would be: string, different from, contant, !
because I don't always have the same image in that field.
2 - are you suggesting that the filter would be: string, not like, constant, and the url of the image?
I don't think I can enter the url of the image in the filter.

#1144824
differnt-from.JPG

Q1) You can compare the value with shortcode attribute value, for example "imageur", see screenshot differnt-from.JPG

and pass the value to Views shortcode's attribute "imageur", for example:
[wpv-view name="VIEW-SLUG" imageur="some-text"]

See our document:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/#accessing-the-arguments

Q2) Same as above, you can use shortcode attribute, in most case, I suggest you use only the image file name as compare value.

#1150131

That doesn't work because the file name could be anything. What I need to account for is no URL in that field. Not a URL with x name in it. Because there are 1000's of possibilties that I don't even know of yet.

#1150379

How do you setup those URLs value in custom field? if it is something like this:

<em><u>hidden link</u></em>

You can compare the field value like this:
"my-field" NOT LIKE "https''

And you can also use Views filter hook wpv_filter_query to create your own custom functions, in this function setup your own custom filters. More help:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
When displaying a View listing posts, this filter is applied to the arguments being generated by the View settings before they are passed to the WP_Query class.
https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.