Skip Navigation

[Resolved] Creating child custom post list with fields from parent post type.

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#578876

Hi

First of all your post relations and editing child from parent is something that i think before starting this project to be perfect for me and i didn't even imagine they could be plugin that could do this. I'm extremely impressed with that:)

I need to display list of all post from one child custom post type displaying custom data from parent post type. I will use real estate example you used. Let say i have 3 villas for rent with total 10 rooms. With custom post fields like that.
Villa (Parent):
Villa name
Adress
square meters
Total Bed rooms
Available Parking space
Pool
ect.
And i have child "rooms"
Room name
Room square meters
Beds
Private Bathroom
ect.

I need to display everything in one table so i will have table like that
Villa Name; Villa Address; Villa square meters; Villa total Bed rooms; Villa Available Parking space; Villa Pool; Room name, Room square meters; Room Beds; Private bathroom
Green Villa, Address 1, 100 meters; 3 bedrooms; 2 privet parking spots; No pool; Bedroom 1; 16 meters; 1 Double bed; Private bathroom.
Green Villa, Address 1, 100 meters; 3 bedrooms; 2 privet parking spots; No pool; Bedroom 2; 25 meters; 1 Double bed and one single; Private bathroom.
Green Villa, Address 1, 100 meters; 3 bedrooms; 2 privet parking spots; No pool; Bedroom 3; 18 meters; Two single beds; Private bathroom.
Blue Villa, Address 2, 200 meters; 5 bedrooms; On street only; No pool; Master Bedroom 1; 45 meters; 1 Double bed and 2 single beds; Private bathroom.
Blue Villa, Address 2, 200 meters; 5 bedrooms; On street only; No pool; Bedroom 1; 25 meters; 1 Double bed; Private bathroom.
Blue Villa, Address 2, 200 meters; 5 bedrooms; On street only; No pool; Bedroom 2; 18 meters; Two single beds; Private bathroom.
ect...

Is it possible?

Paweł

#578960

Dear Paweł,

I think it is possible within Views, you just need to create a view to list child "Room" posts, and in the Views loop section, display the information of child "Room" post and it's parent "Villa" information, see our document:
Displaying Fields of Parent Pages
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

You can also setup a custom search form in above view:
https://toolset.com/documentation/user-guides/front-page-filters/

#579001

Hi

This one don't works. I did try:
1. <td>[wpv-post-title id='$parent']</td>
2. <td>[types field="custom-value" id='$parent'][/types]</td>
3. <td>[wpv-post-title id='$house']</td>

It looks like loop wizard can't process "$" values

Paweł

#579239

For example, the parent post type "Villa" is using slug "villa", you can display the parent "Villa" post title as below:
[wpv-post-title id='$villa']

See our document:
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/
[types field="xxxx" id="$yyyy"][/types]
Where xxxx is the field of the parent you want to show, and yyyy is the slug-name of the parent. The “$” is required, as this represents a variable where the parent post name will be replaced by the post ID, internally.

The forum ‘Types Community Support’ is closed to new topics and replies.

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