Skip Navigation

[Resolved] Display parent and sibling posts

This support ticket is created 4 years, 11 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 – 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 1 reply, has 2 voices.

Last updated by Luo Yang 4 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#1423429
1.png

Hello

I have that uploaded structure.

I need to display a view inside both parent and child post which display links for all languages. I read the documentation about many to many relationship but it won't work for me.

For example if I browse "Child Post 2" I need to display these link inside the post:

<a href="link-to-parent-post">english</>
<a href="link-to-child-post-1">russian</>
<a href="link-to-child-post-2">spanish</>
<a href="link-to-child-post-3">arabic</>

Any help will be appreciated.

Thanks

#1424313

Hello,

It is possible with Views plugin, and in your case, it just need one hierarchical post type

For example:
1) Create a post type "my-cpt", enable below two options:
- Hierarchical
- Page Attributes
So you will get a post type just like WordPress built-in post type "Pages"

More help:
https://developer.wordpress.org/reference/functions/register_post_type/
'hierarchical'
(bool) Whether the post type is hierarchical (e.g. page). Default false.

2) Create/edit each "my-cpt" post, setup the posts hierarchical relationship
- parent-post
---- child-post-1
---- child-post-2
...

3) In single "Child Post 2" post, follow our document to display it's Brother posts:
https://toolset.com/documentation/user-guides/views/displaying-brother-pages/
Displaying Brother Pages