I am trying to: display posts (non protected) in a view
Link to a page where the issue can be seen: hidden link
I expected to see: non protected posts on the page
Instead, I got: no results at all
i use the fallowing in my view loop output editor:
<wpv-loop>
[wpv-conditional if="( '[is-protected]' ne '1' )"] <div class="col-sm-4">
[wpv-post-body view_template="Memorials list for search"]</div>[/wpv-conditional]
</wpv-loop>
it use to work in the past and now for some reason now it doesn't. i don't recall any updates i made recently.
when i remove the conditional output i get all the results on the page but with protected posts (that i want to hide)
<wpv-loop>
<div class="col-sm-4">
[wpv-post-body view_template="Memorials list for search"]</div>
</wpv-loop>
I don't know what's in your custom shortcode, but in any case a better solution is to use the wpv_filter_query filter so that the query doesn't return any protected posts in the first place.
(Your solution means running the conditional check for every iteration of the results.)
You can do that with the following code:
function tssupp_omit_protected_posts( $view_args, $view_settings, $view_id ){
if ( in_array( $view_id, array( 204 ) ) ) { //Edit for IDs of Views
$view_args['post_password'] = '';
}
return $view_args;
}
add_filter( 'wpv_filter_query', 'tssupp_omit_protected_posts', 101, 3 );
Hi Nigel,
When I tried your code on the site it didn't work.
I do see why it make sense to use the approach you suggested and I will give it another shot later on.
the way I solved the issue was to update WP, theme, and all plugins. it did the trick and everything is working as it was designed for. I hope this close the issue...