Home › Toolset Professional Support › [Resolved] Split: Condition in View that depends on intermediary post – QUESTION 1
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.
This topic is split from https://toolset.com/forums/topic/condition-in-view-that-depends-on-intermediary-post/
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: Africa/Casablanca (GMT+01:00)
Tagged: Custom search, Views, Views plugin
Related documentation:
This topic contains 50 replies, has 3 voices.
Last updated by AlimB3245 4 years, 3 months ago.
Assisted by: Jamal.
Hi Minesh
As I am not able to create a new support ticket I will put the queries here (before I forget) and you can please split this thread to a new ticket.
QUESTION 1
I have a post (Eyewear Collection) which has a parent (Brand) and Brand has a parent (Brand Owner).. When I am on the Eyewear Collection Profile Template (Single Page).. I need to get the Brand Owner's ID, Name, Email and Mobile [types field="wpcf-organisation-email' output ='raw'] and [wpv-post-title].. if I had to get it for the Brand, I would have done this..
[types field="wpcf-organisation-email' @item='eyewear-brand-eyewear-collection.parent' output ='raw']
and
[wpv-post-title @item='eyewear-brand-eyewear-collection.parent' ] (would this be right? for wpv-post-title?)
But I don't know how to get it for the Brand Owner (who is the grand parent of eyewear collection).. please advise.
Also I would need to run the condition you helped me with above (function func_check_user_store_value()) to check if the user-store is equal to the brand owner's eyewear-store.. so please advise how I can do this..
Regards,
Alim
Hello. Thank you for contacting the Toolset support.
Please check the following Doc where you will find the information about how you can display grand-parent information.
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/#3-create-a-content-template-that-displays-grandparent-information
So, considering the following relationship:
- State (grand-parent)
-- City (parent)
--- Employee (child)
Create new content template "Content Template for grand parent" that will hold fields that you want to display for the grand-parent with item attribute (state-city relationship slug):
[wpv-post-link item="@state-city.parent"]
Where:
- please replace the correct relationship slug.
Then when you add content template - add the item attribute to content template using the (city-employee relationship slug):
[wpv-post-body item="@city-employee.parent" view_template="content-template-for-grand-parent"]
Where:
- please replace correct relationship slug.
Hi Minesh
I did what you asked me to but I am confused..
I created this content template.. first I created in block-editor and it was like this as I thought I would get all that I needed in one content template
<!-- wp:tadv/classic-paragraph -->
<p>[types field='id' item='@brand-distributor-eyewear-brand.parent'][/types]</p>
<p>[wpv-post-title item="@brand-distributor-eyewear-brand.parent"]</p>
<p>[types field='notification-email' separator=', ' item='@brand-distributor-eyewear-brand.parent'][/types]</p>
<p>[types field='notification-mobile' item='@brand-distributor-eyewear-brand.parent'][/types]</p>
<p> </p>
<!-- /wp:tadv/classic-paragraph -->
then when i was editing the view where I assigned it I changed to to non-block editor and made it just this as I needed only the name
[wpv-post-title item="@brand-distributor-eyewear-brand.parent"]
Then I had this view
hidden link
which had this
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-post-body item="@eyewear-brand-eyewear-collection.parent" view_template="brand-distributors-for-eyewear-collections"]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
where added this within the loop as you can see above..
[wpv-post-body item="@eyewear-brand-eyewear-collection.parent" view_template="brand-distributors-for-eyewear-collections"]
but I realised that If I placed the above line just like that in the Eyewear Collection Template the name of the name of the distributor shows.. so I don't know if I should use it as a view or as a shortcode.. please do advise..
And finally I need to apply the function you created to check if user-store = eyewear-store .. so where do I apply this function?
Please do advise..
Regards,
Alim
Hi Minesh..
Also when I create a content template should I use block editor? It seems to be the only option for me.. but I don't want the variables displayed as blocks but as raw output as they are going to be variables in an URL.. so please do guide me on how to create a content template without using block editor..
Regards,
Alim
Can you please share problem URL and access details and tell me what field you want to display that belongs to grand-parent post type. Also, please clarify your grand parent post type hierarchy.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Can you please tell me where you created the Content Template: "brand-distributors-for-eyewear-collections"
I've visited the Content Template listing page but I do not see the CT "brand-distributors-for-eyewear-collections":
=> hidden link
Hi Minesh
you are working on the main site.. you need to be in the subsite
Anyways here's the link to the VIEW which has the TEMPLATE..
First I had created a template using block editor but after adding to the view as I had to remove the <p> tags etc, I changed it to a NON BLOCK EDITOR template from within the view (that's what I actually wanted to know too.. can I create a content template directly as a NON BLOCK EDITOR without going inside a VIEW.. please advise)
Here's the link to the VIEW (Screenshot attached)
hidden link
Regards,
Alim
Can you please tell me where you added that view? I mean to what page on front-end.
As you shared the following link:
=> hidden link
And when I try to load the above link for your subsite - it redirect back to above link (your main site)
=> hidden link
Hi Minesh
I am sorry I was a bit confused with your last email.. both the links you shared seem to be the same..;-)..
hidden link
and both work well for me.. (screenshot attached)
I've used the VIEW in this content template
hidden link
Sorry if my communication has not been very clear.. Please do let me know if it's ok now..
Have a nice day..:-)..
Regards,
Alim
This is your main site link: hidden link
And when I try to load the same link on subsite "youandeyemag" :
=> hidden link
This link (the subsite link)
- hidden link
redirect back to (your original site link):
- hidden link
So, what i'm saying is I cant access this link on subsite:
=> hidden link
As when I try to load the above link - it redirect back to original site:
==> hidden link
Hi Minesh
There's some issues in the URL you are sharing.. I am sorry if I sent those to you but I have no idea how I managed to do that if I sent them to you..
hidden link
the youandeyemag.com should be fourplusmedia.com (as that's the main site) an /youandeyemag is the subsite..
but with domain mapping the actual site is
hidden link
there's no site as hidden link
It's hidden link or hidden link
Regards,
Alim
The following is your live site - correct?
=> hidden link
When I try to load your subsite:
=> hidden link
It redirect back me to your live site link:
=> hidden link
That is what I'm trying to say.
Hi Minesh
I am really confused by what you are trying to say
This link
hidden link
will definitely redirect to this
hidden link
as that's how subsites and domain mapping works.. My site is a multisite installation with fourplusmedia.com as the main site and there are 2 ways to access it.. as a subdirectory (hidden link) or as the mapped domain (hidden link)
so what you are experiencing above is perfectly in place.. no?
Regards,
Alim
The two links below will explain how it works..
The aliases are defined here
hidden link
Domain Mapping is enabled here.
hidden link
Hope this is what you were wanting to know.. I am not sure..
Regards,
Alim
ok got it - thanks.
I just wanted to double check that I'm not editing your live site.
Can you please share link of the post where I can see the "eyewear-store" field?