Skip Navigation

[Resolved] Display title of Parent in a filtered child view

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

Problem:
How to display parent post information with hierarchical post structure set using posttype when you pass parent post ID using URL param.

Solution:
You can access URL param using view's shortcode:

[wpv-search-term param='your-url-param']

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/display-title-of-parent-in-a-filtered-child-view/#post-609413

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

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

Our next available supporter will start replying to tickets in about 0.89 hours from now. 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 Armando 6 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#608748

Follow up from:
https://toolset.com/forums/topic/displaying-hierarchical-content/#post-608062

Tell us what you are trying to do?
Get the title of the parent title in a filtered view

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

Currently, I have a filtered view which shows children posts linked from a parent CPT.

Example:
My CPT: my-portfolio

URL:
mysite.com/my-portfolio/

I have parent and children pages using WP hierarchy.
parent
parent
parent
-child
-child

I click on child, where portfolio-child Is a child page, my URL is:
portfolio-child/?wpv-child-of=654

In my child view, which lives in a page has the following filter:
Select posts that are children of the Post with ID set by the URL parameter wpv-child-of.
eg. hidden link

So my URL is:
portfolio-child/?wpv-child-of=654

I would like to retrieve the title of the parent page, but I am getting the title of the static page the view lives in:
So instead of getting:

Portraits Main (parent of CPT)
my-portfolio/portraits-main/

I am getting the title of the static page where the view is.

I have tried [wpv-post-title id="$cpt"]

Thank you!!

#608794

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - could you please tell me which shortcode you use to display your parent title?
I see you tried with following:

[wpv-post-title id="$cpt"]

Could you please try following code:

[wpv-post-title id="$my-portfolio"]

Where - "my-portfolio" is your parent post type slug. If your parent post type slug is different you should change it accordingly.

#608797

$cpt is custom post type, in my case, $my-portfolio. This is what I tried and did not work. Thanks.

#608807

Minesh
Supporter

Languages: English (English )

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

Well - I need to check on your install whats going wrong there in order to be of quick help.

*** 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.

#609413

Minesh
Supporter

Languages: English (English )

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

Well - I check that you are not using classic post type relationship but hierarchical post structure.

To get the parent post title - you should use the shortcode:

 [wpv-post-title id="[wpv-search-term param='wpv-child-of']"]

More info:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

Could you please confirm it works for you and solution help you to display the parent post title.

#609535

Thank you for pointing me to the documentation, I would have never guessed to use search term.

Thanks for your help.