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 8 years, 9 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.
I am trying to: Add a custom field for the post type "testimonials" that will allow the user to make a link to a post of the type "practitioner". I could use the URL field type, but wondered if it's possible without copying and pasting the URL from the front end? The site is for a therapy centre with many different therapies and practitioners. We want to be able to link the testimonials to the practitioners.
Ultimately, I will want it to be output in the front end as a link to the profile page of the appropriate practitioner (website.com/practitioners/their-name). So there will be a testimonials page that loops through each post of the type "testimonials", displaying the quote itself, plus the name of the practitioner to whom the quote refers, and a link to their profile.
My objective is to make it easy for my client to make the link to the practitioners when they are adding the testimonials, so at present I have one field for the name, and another where they just paste in the URL, as copied from the front end). That will work fine, but I just wondered if there's any way for them to be able to select the practitioner from an automatically populated dropdown list. Now that I'm writing it down, I realise it's not very likely! Though I suppose if they were to enter just the practitioner's name (correctly!), I could then use that to get the URL. Thank you
Thank you for explaining, I understand now. There are apparently 2 ways to make it easy for a person entering the data. Please consider followings:
A) You can make practitioner, a parent of Testimonials CPT. This way, when you will be adding a new testimonial in the WP Admin, you will see a drop down list, showing all practitioners. So you can select the right one. And on your Testimonials View, you can use [wpv-post-link id="$parent"] to show the title of the Practitioner linked to her page. This option however requires some understanding about Post Relationships, please see https://toolset.com/documentation/user-guides/creating-post-type-relationships/ for more information.
B) The other option does not require any kind of relationship, and is quite straight forward. But user must always type in the "exact" name of practitioner as it was entered for her post title. This requires to add following code in your theme's functions.php file:
Please carefully notice the nesting of [wpv-post-field] in [link-practitioner] short code. Also remember to register [link-practitioner] short code in Views -> Settings -> Third-party shortcode arguments section. Further, replace "wpcf-practitioner" with appropriate name of custom field, used to store practitioner name (with a testimonial).
I hope adopting any of these will help resolving this issue. Please let me know if I can help you with anything related.