Accueil › Toolset Professional Support › [Résolu] Split: Matching "Looking for" and "I am" taxonomies
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.
Ce sujet est une subdivision de https://toolset.com/fr/forums/topic/how-to-create-a-list-to-display-the-last-5-cpt-posts-created/
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)
Marqué : Content Templates, Views, Views plugin, WordPress Archives
Documentation connexe :
Ce sujet contient 22 réponses, a 2 voix.
Dernière mise à jour par francescoG-3 Il y a 5 années et 11 mois.
Assisté par: Nigel.
2 - when a user create his own profile post, he set his preference about genre with two specific Taxonomies, first called "Sono" (in english "I am") with two value "Man" and "Woman", the second called "Cerco" (in english "I search") also with two value "Man" and "Woman" too.
So, if it set that the I search in "woman", when he navigate in all site pages, and in all profile posts lists, the items displayed should be the profile post that have the "I am" value at the same "I search" value setted in the profile post of the current logged in user.
It is possible to do that with query filter or using some custom codes?
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
I'm still working out how to do this, I don't have it working yet, but I've run out of time today, I'll update you on Monday.
Ok, thank you very much.
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
It is not so complicated, I had a simple typo when I set up a test on Friday which prevented it from working.
So your profile posts have taxonomies assigned for the sex of the profile, and the sex they want to meet.
So you create a View—to be displayed on a profile page—which will display "matching" profiles.
You need two Query Filters, one for the "I am" taxonomy and one for the "I search" taxonomy.
You will pass the values of these for the starting profile to the View using shortcode attributes.
So where I insert the View in the template for profiles on my test, it looks like this:
[wpv-view name="seeks" wpvsex="[wpv-post-taxonomy type='sex' format='slug']" wpvseek="[wpv-post-taxonomy type='seek' format='slug']"]
Note that in my test site I am using "sex" for the person's sex, and "seek" for the sex of the person they are looking for, and so Views auto-suggests the shortcode attribute wpvsex and wpvseek.
In the above I am passing the *current* profile's values to the View.
But in the View itself, I swap over the names of the shortcode attributes in the Query Filters (see screenshot), so that I compare the "I am" of the source profile with the "I search" of the target profiles, and I compare the "I search" of the source profile with the "I am" of the target profiles.
Sorry for my delay in reply, but I have little time this period.
I will try this solution this weekend!
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
OK
I don't know why, but it don't work to me...
here, lien caché , see the "Seek Items lists carousel: "
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
There are two problems.
In your View you didn't swap the query filters around as I show in the screenshot above (https://toolset.com/forums/topic/split-matching-looking-for-and-i-am-taxonomies/#post-1195393).
You are comparing sesso to sesso and cerco to cerco but you need to be comparing cerco to sesso and sesso to cerco.
Also, you inserted this View on a page. The page does not have the cerco and sesso taxonomies assigned. The View should be inserted into the template for profiles, which do have these terms set.
In your View you didn't swap the query filters around as I show in the screenshot above (https://toolset.com/forums/topic/split-matching-looking-for-and-i-am-taxonomies/#post-1195393).
You are comparing sesso to sesso and cerco to cerco but you need to be comparing cerco to sesso and sesso to cerco.
I have do the correction in the query filters.
But I need to apply this query filter in all Views and pages where all profile posts are showed.
If I insert it into My Profile page, it show me only the related profile posts that I'm looking for. And then it work fine in My Profile page.
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Sorry, I'm not quite sure from your last reply what the problem is.
My understanding is that the starting point for this must be a profile (whether viewed directly, or from a View listing profiles).
A profile has sesso and cerco taxonomy terms assigned.
When you insert the View into the template for a profile (whether a single template, or the template for the output of a View listing profiles), you must provide the sesso and cerco terms for the source profile, and then in the View which lists "matching" profiles you switch those terms to compare sesso to cerco and cerco to sesso.
Hi Nigel,
well, the code works fine in My Profile page, but if I put it in the Profile Post Template I see the list of profile posts related to the terms assigned into the Profile Post about the post author...
So, this is not what I need.
I need to have the list of profile posts related to the terms assigned to my profile post.
It is possible to do that?
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
On the my profile page you use a View to set the context to the profile post of the currently logged-in user, and so this View we are discussing here will correctly show the matching profiles.
What is it that you expect to happen when looking at some other profile post?
The "matching profiles" should be profiles which match the profile being viewed? Or they should match the match the profile of the logged-in user and ignore which profile is being looked at?
Thanks for the reply.
I expected to see that the "matching profiles" should match the match the profile of the logged-in user and ignore which profile is being looked at.
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Just as a reminder, you insert the View like this:
[wpv-view name='matching-items-carousel' wpvsesso='[wpv-post-taxonomy type='sesso' format='slug']' wpvcerco='[wpv-post-taxonomy type='cerco' format='slug']']
The wpvsesso and wpvcerco attributes get their values (using the wpv-post-taxonomy shortcode) from the current post.
On the my profile page you use a View to set the context so that the profile post is that of the current (i.e. logged in) user.
If you insert the above View in the same way on the template showing other people's profiles, then the context is... the other person's profile.
But you want it to be the currently logged-in user's profile.
Which means you must do the same: create a View which queries profile posts, limited to 1, with a Query Filter for the post author to be the currently logged-in user. You can then insert the above View in the same way, inside the output section of this View.
Hi Nigel,
thanks for the reply.
I don't know... I think I'm stupid... I have do what you have written, but I have "No items Found"... see the attached image.