Skip Navigation

[Resolved] Custom search with an all members view

This support ticket is created 6 years 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
- 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)

This topic contains 12 replies, has 2 voices.

Last updated by laurieB 6 years ago.

Assisted by: Nigel.

Author
Posts
#1148744

Tell us what you are trying to do? I'd like to create a search on a page that currently displays all members.

Is there any documentation that you are following? https://toolset.com/documentation/user-guides/front-page-filters/

Is there a similar example that we can see? hidden link This is what I've come up with so far. Not exactly what I'm looking for

What is the link to your site? membership.eyeprosper.com

#1148745

This page displays all the members in the network. On the home page there is a category search. On this page, I'd like to visitors to be able to search business name, personal name, category, location or keyword. I was able to add specific drop downs, but when I tested, no results were shown. The link I provided was my latest attempt. The view is in place so I created a duplicate to mess with.

Thank you.

#1149100

Nigel
Supporter

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

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

Hi Laurie

These member profiles are posts, is that right? (Not users, with custom user fields.)

A post custom search View can include filters for the custom fields and taxonomies belonging to the posts being searched.

So if you have something like a member-profile post type, and that post type has business name as the post title, personal name as a custom field, location as an address custom field, category as either a built-in WP category or a custom taxonomy, then you should be able to add functioning filters for each of these (adding a text search for the business name, possibly using Relevanssi if you wanted the personal name to be included in the text searches).

Does that sound like your use case, or is there something there which points to why it might not be working?

It may help if I take a look at the backend, let me set up a private reply to get credentials from you.

You may want to create a temporary admin user for me to use that you can later delete, and be sure to have a current backup.

#1149270

Nigel
Supporter

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

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

Hi Laurie

I've been trying to look at your site and check the set up but I can't edit certain content because it is locked because you are currently editing the same, so I'll try again later.

#1149279

Oops! Sorry, I still had the windows open. I'm working on adding events, everything else is closed out.

#1149765

Nigel
Supporter

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

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

Hi Laurie

I looked at your All Members page.

It's designed with Elementor.

A custom search View comprises two parts, the search form with filter controls, and the search results.

Typically when you insert a View you insert both together, but you have the option of separating the form and the results to display them in different parts of the page.

In your case you have inserted just the search form at the top of the page using a Views widget.

But you haven't included the search results anywhere on the page (which I would expect you to do by adding another Views widget and choosing to show the results from the same View).

Instead you have inserted a completely different View using a shortcode widget. That View won't respond to any searches you make in the search form at the top of the page, which belongs to a different View, and your second View does not include search itself.

Fix that and then you'll start seeing the results respond to the search filters and it should make more sense.

You can include filters for your custom fields or taxonomies. It may make sense for your location search to be a distance search based on the address field rather than use the city and state single field (or to break those out into separate fields).

#1149901

Yes, I understand that. I created a duplicate of the view and was working on setting that up. I had not updated the shortcode in Elementor yet.

I am working on All Members with Search. I was having trouble getting the post results to show up. I want the search to filter and show the post view (profile image, name, category, location) as in all members.

#1149969

Nigel
Supporter

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

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

Hi Laurie

I tried to edit the page where the View is located but it is locked again.

I added a new page "Toolset" and inserted the View, and checked it on the front-end.

I can see that it is a work-in-progress, but it is working.

I'm not sure if there is something you are stuck on.

#1150010

Yes, was working on it. I have a call in a few hours with the client. Wanted to show progress.

1) Company name works with a dropdown. All set
2) Search works with an input field. How do I add a value to inside the box, "Search by category or keyword", was not an option that I could see.
3) Location didn't work. I used business address filter, but I'm unsure how to filter it correctly. A visitor to the site would be searching near them or in an area. There are a lot of members in CA and NY, then others scattered. This is the one I'm stuck on.

I worked with Lao on filtering the map to view nearby members. We were filtering 4 members close, but some custom code was involved. https://toolset.com/forums/topic/member-profile-page-display-members-near-me-view-select-url-custom-fields/

Wondering if having the map at the bottom of the page showing all members like the member profile pages would work?

Trying not to over complicate this, but want general search options so members can meet each other, or visitors can find other members with commonalities.

#1150498

Nigel
Supporter

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

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

2) For the text search field you can specify a placeholder in the UI dialog at the time you insert the filter control, or add one later via the placeholder attribute that you can add to the wpv-filter-search-box shortcode (https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-filter-search-box).

To be clear about what the text search box does, it searches the post title and (optionally) the post content. If you add Relevanssi to your site and set up its indexing options, it can also optionally search the text of custom fields (that you specify) and taxonomy terms assigned to the posts. (See https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/)

If you want to search categories, you may want to include a filter specifically for that (as a dropdown, for example).

3) Location search.

I created a new View to demonstrate: "toolset" which is inserted on the page "toolset".

You can see in the screenshot I searched for businesses within 50 miles of Los Angeles. It appears to work as expected.

Please take a look at the View to see how it works. I followed the basic steps that are described in the documentation. From the other thread you linked to, I assume you are familiar with it.

#1150758

Thank you Nigel. All set with the placeholder. Must have skipped that before. I have started to set-up Relevanssi. Categories are an option on the home page, so I didn't want to duplicate efforts.

On location, yes, it works, but shows a list of business names. Is it possible to display the profile image, name, etc info like the other filters, or does the map need to show? I know this was NOT the case when using the map. It just seems out of place.

#1151299

Nigel
Supporter

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

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

Hi Laurie

You don't need to use the map when including a distance filter.

The distance filter affects which posts are returned by the Views query, the map is just one way of outputting them.

In my example I just output the post title so that it was visible which posts are being returned, but you can include whichever fields you want in the output section.

Probably a good idea to run the Loop Wizard and group the fields you choose to add into their own template, opting for whatever output format suits (e.g. a bootstrap grid).

#1155550

My issue is resolved now. Thank you!