Skip Navigation

[Resolved] Display parent posts of several child post types

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

Problem:
I have several parent Posts of several Child Posts.
How do I display them all in one View?

Solution:
Please select all Post Types in the View's Setting "Content Selection" that you need in this View (all child posts)

Do NOT select the Parents of the Post Types that you already Query in this View.

You can access the Information of those Post Types easily with the ShortCode ID attribute "id".

Hence, do select only the CHILD post Types of which you want to get parent information.

Then, in the Loop, call the fields once a Post Type.
This means, your Loop or Content Template will look similar to this after:

<td>[wpv-post-link id="$group"] [wpv-post-link id="$other_parent"]</td>
<td>[types field='group_sort_name' id='$group'][/types] [types field='group_sort_name' id='$other_parent'][/types]</td>
<td>[wpv-post-taxonomy type="area" id="$group"] [wpv-post-taxonomy type="area" id="$other_parent"]</td>
<td>[wpv-post-taxonomy type="genre" id="$group"] [wpv-post-taxonomy type="genre" id="$other_parent"]</td>

Above will show information about the parent post types "group" and "other_parent".

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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

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

Assisted by: Beda.

Author
Posts
#574939

Hi, I have a problem displaying more than one types from content selection.

I have post types:

1. groups
2. artists
3. labels

and intermediate post types, which connects:
group label
Artist label

When I select only "Group label" from content selection the following code works as needed and displays groups, which are connected to label.

<td>[wpv-post-link id="$group"]</td>

Example link is: hidden link

But I need also include artists to the same table. Is it possible?

Thinking logically I need to select "Artist labels" from content selection and and some expression to [wpv-post-link id="$group" id="$artist"], but it is not working.

Thanks in advance,

K

My code is:

Loop Output:

[wpv-layout-start]
[wpv-items-found]

Groups

<!-- wpv-loop-start -->
<table width="100%">
<thead>
<tr>
<th>[wpv-heading name="post-link"]Name[/wpv-heading]</th>
<th>[wpv-heading name="group-sort-name"]Sort Name[/wpv-heading]</th>
<th>[wpv-heading name="area"]Country[/wpv-heading]</th>
<th>[wpv-heading name="genre"]Genre[/wpv-heading]</th>
</tr>
</thead>
<tbody class="wpv-loop js-wpv-loop">
<wpv-loop>
<tr>
[wpv-post-body view_template="loop-item-in-echo-labels-groups-table"]
</tr>
</wpv-loop>
</tbody>
</table>
<!-- wpv-loop-end -->
[/wpv-items-found]

[wpv-no-items-found]
[wpml-string context="wpv-views"]There is no assigned artists with [wpv-post-title][/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

Template is:

<td>[wpv-post-link id="$group"]</td>
<td>[types field='group_sort_name' id='$group'][/types]</td>
<td>[wpv-post-taxonomy type="area" id="$group"]</td>
<td>[wpv-post-taxonomy type="genre" id="$group"]</td>

#575018

You can pass only one ID attribute per ShortCode and only one value each such attribute.

But you can pass as many ShortCodes as you want.

Therefore, please select all Post Types in the View's Setting "Content Selection" that you need in this View.
Do NOT select the Parents of the Post Types that you already Query in this View.
You can access the Information of those Post Types easily with the ShortCode ID attribute.
Hence, do select only the CHILD post Types of which you want to get parent information.

Then, in the Loop, call the fields as you do already, but once a Post Type.
This means, your Loop or Content Template will look similar to this after:

<td>[wpv-post-link id="$group"] [wpv-post-link id="$other_parent"]</td>
<td>[types field='group_sort_name' id='$group'][/types] [types field='group_sort_name' id='$other_parent'][/types]</td>
<td>[wpv-post-taxonomy type="area" id="$group"] [wpv-post-taxonomy type="area" id="$other_parent"]</td>
<td>[wpv-post-taxonomy type="genre" id="$group"] [wpv-post-taxonomy type="genre" id="$other_parent"]</td>

Please do not select the Parent Post type in the Content Selection - choose only the Child Types.

#575064

Thanks