Skip Navigation

[Resuelto] Show Sponsored posts on top

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:

The issue here is that the user had a Parametric Search view, but wanted to show their sponsored events at the top.

Solution:

It is possible to have 2 views that are controlled by the same filters

This will allow for both views to be filtered.

Ok so what you need to do is select the view that you want to have the filters.

So you will create the search filters in that view.

Secondly on the view that you want to allow the filters to work on you are going to manually add the query filters to that view.

The easiest way to do this is to add the same set of frontend filters to the view and then remove them from the editor section. This will cause the actual query filters to remain. Save your view and then add both views to the same page.

This support ticket is created hace 5 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.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Este tema contiene 8 respuestas, tiene 2 mensajes.

Última actualización por Sasank hace 5 años, 8 meses.

Asistido por: Shane.

Autor
Mensajes
#1220116
Capture.JPG

I have a custom field for posts where we can check if the posting is sponsored or not. So, while creating a loop in view sorted by date I would like to show the sponsored posts on the top. How can it be achieved?

#1220342

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Sasan,

Thank you for contacting our support forum.

The best way to do this is to create a separate view for the Sponsored Items.

Add a filter to the view to only let that view display sponsored items. The reason is because you can sort by the sponsor custom field, however if only the sponsored posts have that field selected then the other posts won't show up.

Please let me know what you think of this.

Thanks,
Shane

#1220558

Hi Shane,

Thank you for your reply. I had already thought of it but, that wont solve my prob. I also would need to be able to have filters for sorting by date, location etc. you can see example here enlace oculto

Thanks,
Sasank

#1220993

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Sasan,

I see what you mean.

Do you mark the non-sponsored items as well ? Meaning Is there a checkbox to determine if the item is sponsored or not ?

Because what we can do is to use the views sorting option to sort by this custom field.

This way when you sort it all the sponsored events will come up first. This will only be for the initial load, because once you start to sort it by date and other attributes on the frontend , the sponsored items are going to get mixed up again.

Thanks,
Shane

#1221049

Hi Shane,

Yes there is a radio button for marking sponsored or not.

I did that too but they want it to be sorted by date itself. That is what ended up here!

If we have 2 views in a view can we filter both same time with filter on parent view? Is there a way we can pass the values?

Regards,
Sasank

#1221089

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Sasan,

This is going to be a bit tricky.

It is possible to have 2 views that are controlled by the same filters, however you cannot do the filters using the AJAX reload, you will need to do a full page refresh.

This will allow for both views to be filtered.

If you are willing to try this method I can walk you through the steps to get it working.

Please let me know so we can proceed.

Thanks,
Shane

#1221092

Yes Ajax reload is not important

Regards,
Sasank

#1221167

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Screenshot 2019-03-26 at 3.46.47 PM.png

Hi Sasan,

Ok so what you need to do is select the view that you want to have the filters.

So you will create the search filters in that view.

Secondly on the view that you want to allow the filters to work on you are going to manually add the query filters to that view.

The easiest way to do this is to add the same set of frontend filters to the view and then remove them from the editor section. This will cause the actual query filters to remain. Save your view and then add both views to the same page.

Try the filter and let me know if both views work. If not then we can run through and see what steps are missing.

Looking forward to hearing from you soon.

Thanks,
Shane

#1221945

My issue is resolved now. Its working with Ajax.
Thanks for your guidance.

Regards,
Sasank