Skip Navigation

[Resolved] There are 2 issues i am facing right now

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

Problem:

From first issue, Why the Location is not wokring while the Search by site # is working? Note that this 2 custom fields are in the same custom post type.

From 2nd issue, why it only allows me to add one ancestor? How to add more like from the documentation?

Solution:

Q1) You are using below filter:

Location Address is a string equal to URL_PARAM(wpv-wpcf-location-address)

I suggest you change it to:

Location Address is a string LIKE URL_PARAM(wpv-wpcf-location-address)

Q2) You can setup two post type relationships:

- Many-to-many relationship between post types "Client" and "Consultant"

- One-to-many relationship between post types "Consultant" and "Projects"

Edit each "Consultant" post, related it to other "Client" posts.

Then you will be able to setup the cascade menus according to our document.

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/how-to-filter-posts-by-their-ancestors/

This support ticket is created 5 years, 6 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by abdullaA 5 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#1303237

Hi,

I did play around and it seems working for some of the fields and other fields are not working.

There are 2 issues i am facing right now.

1. Like for example, the Search by site # (custom field inside Project post type), i change from the previous "string" to "number" and now it shows a result.
Type of project (which is a taxonomy) is working as well. But the Location (custom field inside Project post type) is not working.

2. Also, i did follow and add the Filter by related posts (relationship ancestors) https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/how-to-filter-posts-by-their-ancestors/

Though from the documentation it shows you can add one or more ancestors, but when i try to add the Client and Consultant. it only allows me to add one.
I have 3 custom post type which is the Project as the main, then consultants and clients has a one to many relationship.

My question now is,
From first issue, Why the Location is not wokring while the Search by site # is working? Note that this 2 custom fields are in the same custom post type.
From 2nd issue, why it only allows me to add one ancestor? How to add more like from the documentation?

And when you open the hidden link
At first all the details are showing, but when you start searching. The Client details shows No Items found.

Below screenshot before and after image.
Before searching: hidden link
After searching: hidden link

#1303251

Thanks for the details, I am checking it in your website, will update here if there is anything found.

#1303279
Location.JPG

Here are what I found:

Q1) Why the Location is not wokring ...

I have tried it in your website, with below steps:
1) Open URL hidden link
2) In the search form, text box "Location", input text: Studio City,
3) Press "Enter" key, I can see the search results are updated, there are two results, see screenshot Location.JPG
4) And in the post view "Completed Project Search View":
hidden link
You are using below filter:
Location Address is a string equal to URL_PARAM(wpv-wpcf-location-address)

I suggest you change it to:
Location Address is a string LIKE URL_PARAM(wpv-wpcf-location-address)

Then you will be able search the result with other partial keywords, for example: Studio

Q2) why it only allows me to add one ancestor?

Views can
In the document you mentioned above:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/how-to-filter-posts-by-their-ancestors/

There are four post types:
- Country
- City
- Neighborhoods
- House
And three post type relationships:
- One-to-many relationship between: Country and City
- One-to-many relationship between: City and Neighborhoods
- One-to-many relationship between: Neighborhoods and House

As you can see, those are hierarchical relationships, so it can setup cascade menus.

But in your website, you are using below post type relationships:
- One-to-many relationship between: Consultants and Projects
- One-to-many relationship between: Clients and Projects
They are not hierarchical relationships, one view can insert only one relationship filters, so you can add only one post type relationship into the filters.

#1303435

Thanks for the response.

From Q1, it works like a charm.

I have a follow up question though, does it support calling from other post type (relationship)?
Because i did try to add Client and Consultant search filter, with the same settings of the Location above. When I try to search it does not show result.

Also as above mention, if you open the completed project page, all details will show up but when you start to search, the Client detail is not showing.

Below is my video desktop screencast for your reference.
hidden link

From Q2, i remove for now as i am trying to figure out the Q1. If my issue on Q1 will be solved with my current layout setup I will disregard this Q2 option.

Just a question, if i plan to use this ancestors, will it not break or messup if i modify the current relationships of my 3 custom post type to make it hierarchical relationships?

Thanks

#1303481

For the new question:
Q1) does it support calling from other post type (relationship)?

No, there isn't such kind of built-in feature within Views, Views is using WordPress class WP_Query to query posts, so if you are filter the posts on custom fields, those fields must exist in the posts.
https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters

And we have a plan to add two or more relationship filter to Views, but I am not sure when will it be released. You can also add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

Q2) if i plan to use this ancestors, will it not break or messup if i modify the current relationships of my 3 custom post type to make it hierarchical relationships?
That depends on yourself, I am not sure if such kind of hierarchical relationships can fit for your website.

#1303715

Hi,

What would be your best recommendation on my current issue in order for me to achieve the result which is i can filter by Client, Consultant, Location and Site no.

I did already 2 setups
1. Using Archives: hidden link
The problem is the client and consultant is still not working when you search.

2. Using Views: hidden link
The problem is the client and consultant is still not working when you search. ( My remedy from this is that I make the Client as ancestor) and now the only problem left for me is the Consultant.

Thanks

#1304563

In your case, I suggest you try these:
1) Setup three post types:
- Client
- Consultant
- Projects

2) Setup two post type relationships:
- Many-to-many relationship between post types "Client" and "Consultant"
- One-to-many relationship between post types "Consultant" and "Projects"

Edit each "Consultant" post, related it to other "Client" posts.

Then you will be able to setup the cascade menus according to our document:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/how-to-filter-posts-by-their-ancestors/

#1308833

Thanks I will try to do that recommendation. though it seems a lot of editing.