Skip Navigation

[Resolved] Parent ID search

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

Problem: I would like to use the value of a URL parameter as a shortcode attribute for a View.

Solution: Use the wpv-search-term shortcode to access URL parameter values.

[wpv-post-title item="[wpv-search-term param='parent_id']"]

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

This support ticket is created 5 years, 1 month 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 1.61 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by geoffD 5 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1340405

Hello

I have a page where a CPT 'PERSON''s ID is passed in the url as a parent_id as below:

hidden link

What I want to do is display the post title for this parent_id on the page so:

[wpv-post-title ] (of the post id 10060 in this example)

Hope this makes sense

Best regards

Geoff

#1340583

Hi Geoff, sure that makes sense. We have a shortcode wpv-search-term that allows you to access URL parameter values. Here is an example based on the link you provided:

Parent ID: [wpv-search-term param='parent_id']

The documentation for this shortcode is available here: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

Looks like you already know about the wpv-post-title shortcode as well, but you may not know that you can specify which post's title you would like to display. You can use the "item" attribute in the shortcode to specify a different post's ID, setting a different post context. Here's an example:

[wpv-post-title item="1234"] 

You would combine these two shortcodes to output the post title based on a URL parameter post ID:

[wpv-post-title item="[wpv-search-term param='parent_id']"]

Let me know if you have any questions about that.

#1341425

Worked a treat...thanks a million...!