Skip Navigation

[Resolved] Using CRED for WordPress comments – How to make form work

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

Problem: I would like to use CRED to create comment posts, and I would like those comments to be children of the current Lawyer CPT.

Solution: Create a new CRED form that creates CRED Comment posts. Auto-generate the form markup, and wrap the parent select field in a hidden div. Define the value of the parent select field using the ID of the current post:

<div style="display:none">
[cred_field field='_wpcf_belongs_lawyer_id' value='[wpv-post-id id="$current_page"]' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>

Relevant Documentation: https://toolset.com/documentation/user-guides/cred-forms-for-child-content/

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

Author
Posts
#629270
Screenshot 2018-03-28 20.31.25.png

I am trying to: create a comments system with CRED. I created post type (CRED Comments), created fields (CRED COmment Fields), make child-parent relationship, and then created CRED Comment Form. Then using layouts, I inserted CRED Comment form in single post type display in parent post type. CRED form is not working. It is displaying code:-

[cred_field field='reviewer-name' post='cred-comment' value='' urlparam='' class='form-control' output='bootstrap'][cred_field field='reviewer-phone' post='cred-comment' value='' urlparam='' class='form-control' output='bootstrap'][cred_field field='reviewer-email' post='cred-comment' value='' urlparam='' class='form-control' output='bootstrap'][cred_field field='review' post='cred-comment' value='' urlparam='' class='form-control' output='bootstrap']

Link to a page where the issue can be seen: hidden link

I expected to see: a CRED frontend submission form. When a comment is added, it goes under parent category automatically.

Instead, I got: Code

#629295

Your CRED Form content is not created with the Wizard but manually and is wrong.

Please head to the CRED form, delete the content and press " Autogenerate Form".

Save the form and re-test the front end where you should find the form working.

#629304

Hi. Form is working now. But there are two problems.
1. last lines show dropdown of parent items. this is a problem as I may have hundreds of parent posts. I want each child - cred comment form do go only in parent where it is displayed.
2. I am unable to show comments in layout of CPT

#629380

1. last lines show dropdown of parent items. this is a problem as I may have hundreds of parent posts. I want each child - cred comment form do go only in parent where it is displayed.
You can automatically define the parent post and hide this input field. Edit the CRED form and find the parent field code:

<div class="form-group">
		<label>lawyer Parent</label>
		[cred_field field='_wpcf_belongs_lawyer_id' value='' select_text='--- not set ---' class='form-control' output='bootstrap']
	</div>

Replace the code above with the code below:

<div style="display:none">
[cred_field field='_wpcf_belongs_lawyer_id' value='[wpv-post-id id="$current_page"]' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>

2. I am unable to show comments in layout of CPT
You should be able to create a View of Comments, filtered by parent, where the parent is set by the current page. Then place this View somewhere in the Lawyer Template Layout. If you need additional assistance creating a View of child posts, please create a separate ticket where we can discuss it in detail. We have more information about querying child posts here:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/

#629470
Screenshot 2018-03-29 11.44.11.png

This is working. Thanks Christian Cox.

How to show all comments of cred form at one place in admin area so that they can be manually approved. WP comments has separate place or link. I tried to add a link through post type but it is not shown anywhere. Is it because CRED comments is a child-post? I ask this because it is not possible to keep checking all parent post entries for child posts. All child posts shild be visible at one place in admin area. See the pic attached

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/post-type-does-not-appear-in-admin-menu/

#629709

Okay great, it sounds like this ticket can be closed.

#629783

Thanks a lot Christian Cox for quick support.