Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.
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.
This support ticket is created hace 6 años, 8 meses. 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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
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.