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.
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.
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.
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.
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.
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