Skip Navigation

[Resolved] Cannot Display Grandparent Information on Grandchild Template

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 10 replies, has 3 voices.

Last updated by garretB 7 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#556538
template-content.jpg
results.jpg

I am trying to: Display the grandparents of my post in a sidebar. I have agencies, which are the parents of agents, and agents are parents of properties. I want to be able to display the parent agent information along with the grandparent agency logo and other agency details.

I expected to see: Only the parent agent in a content layout, where i can add the id attribute to the shortcodes in order to show grandparent values

Instead, I got: Every agency is displayed including those that are not parents the specific post being shown.
To start I followed the instructions on this page but they are not working for me currently

https://toolset.com/documentation/user-guides/displaying-fields-grandparents/

#556568

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Garret,

Thank you for contacting our support forum.

Would you mind providing me with admin access to the website so that I can take a look at this setup for you ?

The private fields will be enabled for your next response.

Thanks,
Shane

#557276

Hi, Shane is currently unavailable but will return tomorrow to continue working on this request. Thanks for your patience.

#557758

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Garret,

Thank you for contacting our support forum.

Unfortunately i'm not able to log into the website could you check on the credentials for me.

Thanks,
Shane

#557791

Im sorry Shane it seems I got something wrong here. I should have tested the log in and I did not. Lets try this :

shaneToolset
wvgL*rx5tMD#JnXZ^pdzH!MS

#557897

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Garret,

Just to confirm you want to display the Agency information on this post correct?

Thanks,
Shane

#557900

Hi Shane,

Yes, I think i should provide a better explanation of what Id like to be able to do. On my properties pages, I have a side bar that so far displays the agent information, like you can see on this post:

hidden link

What I would like to do is figure out how to display the agency my agent belongs too. So to be clear, right now my hierarchy is Properties belong to an agent, and each agent belongs to an agency.

So essentially Im looking to add in the "Grandparent" to my properties pages layout.

I was able to get a grandchild to work here:
hidden link

but the grandparent is giving me a bit of trouble. Thanks Shane!

#558338

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Garret,

I'm still looking into this for you.

We may need to revise our documentation on how to achieve this because I may need to do some custom shortcode to get the correct information.

Thanks,
Shane

#558593

Thanks Shane, take your time no rush, I appreciate you looking into it for me.

#558976

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Garret,

I wrote a manual shortcode to get this done for you.

// Add Shortcode
function parent_id() {

	$post_id = get_the_ID();
	$parent_id = get_post_meta($post_id,'_wpcf_belongs_agents_id');
	$grandparent_id = get_post_meta($parent_id,'_wpcf_belongs_agencies_id');
	return $grandparent_id[0];

}
add_shortcode( 'parent_id', 'parent_id' );

I've already implemented it and created a view to filter the information so you can check it on on the page.

Thanks,
Shane

#558977

Brilliant solution. Thanks so much Shane, this is exactly what I was hoping for.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.