Skip Navigation

[Resuelto] Create a Glossary page

This support ticket is created hace 5 años, 2 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Etiquetado: ,

Este tema contiene 18 respuestas, tiene 3 mensajes.

Última actualización por Nigel hace 5 años, 1 mes.

Asistido por: Nigel.

Autor
Mensajes
#1344481

Hello Nigel,

Thank you for the follow-up.

I followed your suggestion and removed everything inside

<wpv-loop>

then put the content that was in a content template directly outside the loop in the loop editor:

[wpv-view name="glossary-terms-taxonomy-view"]

. I also tried to put it outside of the wpv-items-found shortcode.

Unfortunately both methods did not work, there was no content returned at all. I also tried to keep the content template but had the same results.

Adding the view directly inside the loop and getting rid of our query filter re-create the same issue... We will have the full archive duplicated for every term.

So far it looks like I can only achieve this by adding a query filter and telling the archive to pull only one post but it seems like an unreliable method (i.e: what happens if we delete the post?).

Thanks again for your help!

#1344921

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

It seems there is a basic problem here in that you are trying to get this to work with a post type archive rather than on a static page.

With an archive WordPress runs a query to get the posts to show on that archive.

If you use Views to customise the archive it will modify that WordPress query before it is run, according to the settings for your custom archive, include the addition of custom filters.

But it still runs that main query and uses it to generate the list of posts which are then output according to the loop section of your custom archive.

You could order the results alphabetically, but you cannot group them alphabetically so that you can have separate sections for each letter as is the case on the page you reference: enlace oculto

(They do on that page, but they will be using a custom PHP template for the glossary archive.)

The Views custom archive just sees the results as list of posts and then iterates over them.

The solution you need is to have nested Views. An outer View for the alphabet taxonomy terms, and an inner View for the posts themselves with that alphabet term assigned.

This creates two separate queries, a taxonomy terms query and a posts query.

They have nothing to do with and cannot be integrated with the main archive query if you add those Views to an archive page.

You could ignore the main query, i.e. create a custom archive, output nothing from the archive query itself, and instead insert the outer taxonomy View immediately after the wpv-layout-start opening shortcode, removing anything between the wpv-loop tags altogether.

That would be equivalent to adding the View to a static page, with an important caveat.

You would be doing this just so you could use the same URL as the archive, but at a cost of WP running the normal archive query, the results of which you discard.

You might as well just insert the outer taxonomy View directly into a static page, unless you have a good reason not to. You presumably don't need the archive then, so you can disable the archive in the settings for the custom post type, in which case you should be able to use that URL for your static page.

#1345093

Hey Nigel,

Working with Toolset is fairly new to me so I'm getting used to this kind of workflow.

I figured that the best way to list CPTs was to use its own archive page but I'm learning about the limitations this involves.

I understand now that if you need to do something different than displaying all posts in a simple list, like something we have on the Glossary page, you're probably better off using a custom page and view.

At this point I think we can close this ticket.

Thanks again for your help!

#1345795

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Glad to have been of help 🙂