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.
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.
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.