Skip Navigation

[Resuelto] How to show a CRED form within a custom post types content template?

This support ticket is created hace 8 años. 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 5 respuestas, has 2 mensajes.

Last updated by cathieH hace 8 años.

Assigned support staff: Luo Yang.

Autor
Mensajes
#276350
16-01-2015 15-01-29.jpg

I am trying to: show a CRED form to allow users to write reviews directly on a custom post type page.

I have a parent custom post type of 'vendor' and a child custom post type of 'vendor-review'. I would like to have one page which shows the vendor single listing details (which I've created in a content template) and for a CRED form to show to allow people to write their review director on that vendors page.

I visited this URL: hidden link

I expected to see: A cred form directly on that page.

Instead, I got: was a link to another page to write the review. This works but isn't ideal, I do not want visitors to leave a page in order to write a review.

I see one of two solutions:

#1 - Show the CRED form directly on the page and automatically link all reviews to that vendor.

#2 - show a lightbox pop up allowing reviewers to enter a review specifically for that vendor.

Are either of these scenarios possible? My hope is to have #1 scenario be achievable.

Thank you.
Cathie.

#276688

Luo Yang
Supporter

Languages: Inglés (English ) Chino simplificado (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Types is using a custom field _wpcf_belongs_[parent-slug]_id to store the parent post ID value, I suggest you add a hidden field to replace the parent selector, for example:

https://toolset.com/forums/topic/populating-cred-field-with-current-post-id/

#276756
19-01-2015 11-59-34.jpg

Thank you Luoy for the link but it didn't quite work for me.

I added this code:

[cred-generic-field field="_wpcf_belongs_vendor-review_id" type="hidden" class=""]
{
"required":0,
"validate_format":0,
"persist":1,
"default":"[wpv-post-id]"
}
[/cred-generic-field]

[cred_form form="Vendor Review"]

What did I do wrong as the generic field code is showing up on the front.

hidden link

Thanks
Cathie

#276921

Luo Yang
Supporter

Languages: Inglés (English ) Chino simplificado (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Could you duplicate same problem in a test site, and fill below private detail box with login details, also point out the problem CRED form URL and the page URL, I need a live website to test and debug.

#277160

Luo Yang
Supporter

Languages: Inglés (English ) Chino simplificado (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

You will need put the generic field shortcode into your CRED form:
hidden link

[cred-generic-field field="_wpcf_belongs_vendor_id" type="hidden" class=""]
{
"required":0,
"validate_format":0,
"persist":1,
"default":"[wpv-post-id]"
}
[/cred-generic-field]

Please notice this:
it should be _wpcf_belongs_vendor_id, the "vender" is the parent post type "vender" slug

and removed the codes from your content template:

[cred-generic-field field="_wpcf_belongs_vendor-review_id" type="hidden" class=""]
{
"required":0,
"validate_format":0,
"persist":1,
"default":"[wpv-post-id]"
}
[/cred-generic-field]
#277282

Thank you, I really wish I'd thought to put it into the CRED form .. its my first time using this plugin!
Cathie.