This thread is resolved. Here is a description of the problem and solution.
Problem:
The issue here is that the wpv_filter_query function is causing the user's other views to become empty even though they had provided an ID for which view the filter should affect.
Solution:
The problem with this is that the user had placed the return statement inside the conditional statement for the view to be affected.
If the function is returning the value inside the if statement then all view will be affected and be blank.
What you need to do is to take the return statement out of the conditional statement and your views will return to normal.
I have created a new Views for the "slider" postype and this Views is displaying "post" postypes!
Here is the function I placed in the function.php to get the sort on the first Views (ID 98) :
add_filter('wpv_filter_query', 'add_custom_fiels_to_view_query', 99, 3);
function add_custom_fiels_to_view_query($query_args, $view_settings, $view_id ) {
if ( $view_id != 98 ){
return;
}
Hi Shane,
Thanks for your return.
Unfortunately, this is not helping a lot. I had already tested this solution and retry just now. The result is the same and my second Views is still returning "no items" due to this sorting function.
If you look at the code I sent, the if ( $view_id != 98 ){ does not refer to the function but only to a single return (in order to apply the function only to Views 98. This was the code in the ticket you sent me).
The Views that is linked to the sorting function has the ID 98. The other Views is managing the slider in the home page.
The Views ID 98 is displayed in the aaa page.
Regards
Pat
Notice the return statement is outside of the if statement.
This is needed in the even that the view id doesn't match. The previous function wasn't returning anything hence why your other views were being affected.