Skip Navigation

[Resolved] Archive links in menu with different default filter options

This thread is resolved. Here is a description of the problem and solution.

Problem: I have created a WordPress Archive for a custom post type. The archive displays different results with a Query Filter based on a URL parameter. I would like to create multiple links in my WP Menu that direct the visitor to the archive URL with different URL parameters automatically applied.

Solution: Go to wp-admin > Appearance > Menus to edit the menu you want to adjust. Use the Custom Links feature to add custom links to the archive, with the desired URL parameters applied in the link URL field.

This support ticket is created 3 years, 7 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by alexanderP-4 3 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#2039601

Hi,
I set up a new CPT for events. Then I created an archive page for this CPT.
In the CPT there are different kind of events, like seminar, talks, and so on.
Now I want to have a menu entry for an archive page which shows only seminars. And then another menu entry for showing events which are talks, and so on.
I managed to get the archive page linked to my menu by using the URL. But now I can only access the archive page with on filter set (in the loop selection by a query). Is it possible to have more archive links with different filters?
Thanks
Alex

#2039991
Screen Shot 2021-05-02 at 2.15.48 PM.png
Screen Shot 2021-05-02 at 2.12.30 PM.png

Hi, if I understand correctly you would like to add some custom links to your WordPress menu so the User can visit archives with specific filters predefined. Is that correct?

In the Archive's Query Filters panel, you should be able to set up a custom field filter or a custom taxonomy filter based on a URL parameter (see the attachments). I'm not clear from your details whether the Event type is defined in a custom field or in a custom taxonomy, but either case is filterable by URL parameter. That will display different results based on the link URL, something like these links:
https://yoursite.com/your-event-archive-url/?wpvchapternum=123
https://yoursite.com/your-event-archive-url/?wpvchapternum=234
https://yoursite.com/your-event-archive-url/?wpvchapternum=345
...
and so on. Different URL parameter values will produce different results in the archive when your Query Filter is set up to respond to a URL parameter. The parameter name 'wpvchapternum' here is arbitrary, and you must define one for each filter in the filter configurations. You can create any number of custom HTML menu items with links to these URLs with parameters predefined, as shown in the attachments here. Will this work for your needs, or am I misunderstanding what you want to accomplish?

#2043463

Hi,
Thanks a lot. This sounds exactly like this I would do. I'll try it.
Give me a day to test it.
Thanks

#2044387

Ok, it works very well and will be a good solution for me doing other things.
But in this case I unfortunately need different headings and introduction texts above the archive listing.
Therefore this solution will not work as I need.
Do I have it to do with a view?

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/display-different-header-and-introduction-text-in-archive-based-on-url-parameters/

#2044467

Okay if I understand correctly you also want to display some information in the archive conditionally based on the URL params in the inbound archive link URLs. This seems like a separate issue, because it is not directly related to creating menu items with URL parameters. It's more related to responding to those link URL parameters in the archive and displaying specific content there conditionally. I'll split off a separate ticket to discuss in more detail. Let's focus on the menu items specifically in this ticket, and focus on the archive display in the new split ticket. If you're satisfied with the menu solution we've already discussed here for creating custom links, I think we can close out this ticket and continue our discussion in the new split ticket.

#2044495

My issue is resolved now. Thank you for your great support.