Sauter la navigation

[Résolu] Split: Filtering posts by ancestors

This support ticket is created Il y a 5 années et 11 mois. 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)

Ce sujet contient 12 réponses, a 2 voix.

Dernière mise à jour par francescoG-3 Il y a 5 années et 10 mois.

Assisté par: Nigel.

Auteur
Publications
#1207758

Nigel, sorry, I write you here, because I need assistance in another thread, about using the relationship posts in child posts custom search and select the value with "Select2".
https://toolset.com/forums/topic/how-to-select-a-related-post-value-from-the-custom-search/#post-1207317

So, in this topic (https://toolset.com/forums/topic/drop-down-menus-for-countries-and-cities-in-dependency/), with the Christian Cox suggestion and Toolset guide, I have used the Toolset Relationship functions, to set some post dependencies. Well, I have created the Profile CPT that it is child of Città CPT, that it is child of Provincia CPT, that it is child of Regione CPT, that it is child of Stato CPT, all with parents with an address custom field.
And so, now I'm trying to create the Custom Search and I cannot add the form to search the posts about its dependencies (parent, grand parent, grand grand parent, grand grand grand parent).
So, a solution that I have thought is to create the relative Address Custom Fields into Profile CPT posts, to dynamically save the values about the Parent, Grand Parent, etc... Address Custom Fields. But I don't know what custom code I need to use...
And also, If there is a solution to do what I need, to integrate the Select2 to select the items in Custom Search, because only the Città CPT have up to 8000 items....

Can you help me on that? Because if there are no solutions to do that, all work and all the time will be lost...
Can I pay to have what I need!!!!

#1207762

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Francesco

I think what you are describing is covered with relationship filters where you can add more ancestors than just the parent (e.g. grandparents, great grandparents etc.).

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

To be honest I've never used it before, but I think it covers your use case.

Can you take a look at that and let me know if that meets your needs?

Note that it should allow you to add filters for your chain of post relationships, but it would not mean that you can perform distance searches.

#1207931

Hi Nigel, thanks.
This is what I need, but I think there is a code conflict with my View installation.
Because when I select the Filter by post relationship / repeatable field groups owner, don't appear any dialog box. When I click on it, the system return to the Search and Pagination section...

#1208580

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Screenshot 2019-03-01 at 13.38.37.png

I tried to create a test View on your site for this and, yes, I see a JS error in the browser console and it doesn't work.

I'm trying to take a copy of your site to investigate using Duplicator, which you have installed, but it is getting stuck.

I'll try again later.

#1208700

Thanks.
My site is a big site. It is a WordPress multisite installation and goes over 20Gb of space...
I don't know if you can to do it with Duplicator. But, if you want, to do the backup I use Snapshot Pro, I can create a backup only about this specific site and with the Snapshot Pro you can try to restore it in localhost. But I think that the issue is related to the WordPress Multisite installation.

#1209460

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Francesco

Before trying that, I just ran a check on a multisite installation to see if I could reproduce the JS error when trying to insert a post relationship filter, but could not.

So I don't think it is because you have a multisite network that you are seeing the problem, the most likely cause is a 3rd party conflict, so let's see if we can eliminate that before going any further.

Which means after ensuring that all plugins are up-to-date disabling all non-Toolset plugins and switching to a default theme like twentynineteen.

Does the error still happen?

#1209697

So, I do that, and I have not only deactivated the plugins and the themes, but I have moved them in an external folder, I left only the "type" and "wp-views" folders, but I don't have seen any improvement...

#1210034

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

I have added Duplicator Pro to your site so that I can take a copy of just this site from the network.

I'll install that locally and test again, and will let you know what I find.

#1210035

Thank you very much!

#1210114

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Francesco

I managed to take a copy, install it locally, strip back everything not required (plugins and themes) and re-tested and re-confirmed the issue.

I've passed a copy of that lite-site to my colleagues so that they can debug it further and hopefully get to the bottom of it.

I'll let you know what they find.

#1213024

Hi Nigel,
Something news for me?

#1213055

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Francesco

I had already asked the devs about this earlier this morning as I didn't notice any progress on the internal ticket. I'm told that the fix for the issue should be fairly straightforward and it will be included in the next update for Views—which is due soon—it just hasn't been implemented yet.

#1218385

Hi Nigel,
with the last View update the issue is solved and I can add search filter by post relationship.

Very thanks.