Skip Navigation

[Resolved] Referencing parent post content and parent post author data

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

Problem:
How to dispaly parent post field content on child post.

Solution:
To include a field from the parent post, you would use the following shortcode:

[types field="xxxx" id="$parent-post-type-slug"][/types]

Where:
- Replace "$parent-post-type-slug" with your original parent post type slug. For instance, your parent post type is "Student" and slug setup as "student" then you can dispaly parent post field as:

For example:
[types field="field-name" id="$student"][/types]

You can find the proposed solution with the following reply:
=> https://toolset.com/forums/topic/referencing-parent-post-content-and-parent-post-author-data/#post-561814

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

This support ticket is created 7 years, 3 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by carlosB-2 7 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#561774

Tell us what you are trying to do?

I'm trying to use View to output a table (for a multi-day conference schedule). I'm working with Presenters (set up as Users) who are the authors of one or more Workshops (set up as a CPT). On a side note,

I'm also wanting to integrate two other CPTs, Showcases and One-acts, but if I can get Workshops working, I think I can figure out these other two.

I set up another CPT called Schedules and set it as a child of Workshops, which has custom fields: Sessions (comprised of a day and time) and a Room Number.

I'm trying to set up a View that will output each Session in order (sorted by the Session name) and then sub-sorted by the Room number.

For each Schedule record, I need to pull its Parent Post Title and Permalink (the Workshop Name and link to it), and also the Parent Post's author (display name and user login, and an optional field, Organization).

I thought I might need to set up different Views, or have nested Views, but I'm running up against a wall in getting the parent post content and author info.

Is there any documentation that you are following?

Trying to work with the displaying Child Posts using Views user guide, but I think mine is different enough that it doesn't quite work.

Is there a similar example that we can see?

Here's a sample of what I'm trying to achieve: hidden link

What is the link to your site?

hidden link

#561814

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - I need to review your post type relationship and your view settings to have idea about your current setup. Please kindly share information view you have created and the problem page URL where I can see the issue on first hand.

To include a field from the parent post, you would use the following shortcode:

[types field="xxxx" id="$parent-post-type-slug"][/types]

Where:
- Replace "$parent-post-type-slug" with your original parent post type slug. For instance, your parent post type is "Student" and slug setup as "student" then you can dispaly parent post field as:

[types field="field-name" id="$student"][/types]

More info:
=> https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

#562112

Hello Minesh- Thank you for your reply... I was able to make progress and can display most of what I'm looking for, but now am trying to do some conditional output based on some additional parent post's author information, and am having trouble.

I have set up a wordpress admin account set up for you (I had done this for Luo Yang not too long ago).
Could I send that information to you privately?

#562195

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes sure.

- Please share what you need to check with the conditional statement and state your exact requirements so that I will be able to guide you in right direction.

*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#562220

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've changed the conditional statement as given under:

[wpv-conditional if="( '[types usermeta='prsntr-organization' id='$workshops'][/types]' ne '' )"]
  , [types usermeta='prsntr-organization' id="$workshops"][/types]
  [/wpv-conditional]

Now, you will see the 'prsntr-organization' will display with comma only if it will be available.

regarding your addon query on sorting, may I kindly ask you to open a new ticket for you each new question, as per our support policy we only entertain one question per ticket. This will help other users searching on the forum.

Thank you for understanding.

#562223

That's perfect... thank you!

I will open a new support ticket for my other question.