Skip Navigation

[Closed] Creating a View without a search to display items assigned to a custom post type

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

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 3 years, 2 months ago.

Author
Posts
#2233905

Tell us what you are trying to do?

I currently have a view on my site that looks like this: hidden link
It basically shows all of the custom post type posts (in this case Catamarans) on the page with a search area above it.

I have added a custom field to this post type called "Brokers" - it is basically a checklist of all of the sales brokers at the company. The client then selects the broker responsible for the sale of a catamaran.

What I am trying to do is create a view that looks the same as the one on the link above but WITHOUT the search area and only display the post types for one specific broker. So for example if a broker named John Smith is responsible for 5 of the catamarans, I just want to be able to display those 5 catamarans in a list on a page for John Smith.

Is there any documentation that you are following?
I have tried to follow documentation for creating a view but I can't seem to get it to work without the search form.

What is the link to your site?
hidden link

#2234143

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Belinda

You can pass arguments to a View to provide the values for a filter (instead of adding a front-end control where the user selection provides the value).

This is only supported with the legacy editor for Views, where you insert the View using a shortcode (not using a View block), so that the shortcode can have an attribute added which has the value to pass to the View.

The documentation for this legacy feature can be found here: https://toolset.com/documentation/legacy-features/views-plugin/passing-arguments-to-views/

You won't be adding any front-end filters, you'll be adding a Query Filter (which doesn't require a front-end filter control).

The key you need to bear in mind is that you filter based on the custom field values, not the labels, so if you set up your custom field so that the option "John Smith" means a value of, say, "4" being saved for the field, then the value that needs passing to the the Query Filter is "4", not "John Smith".

You can re-use the same View on different pages, passing a different value to set the filter for different brokers.

The topic ‘[Closed] Creating a View without a search to display items assigned to a custom post type’ is closed to new replies.