Skip Navigation

[Resolved] Post Relationship – Review on a Listing

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

Problem: I have a Form that creates child posts, but they are not connected to the parent post. The child post Form appears on the parent post page.

Solution: Set the parent field value to be the ID of the current post and hide it using CSS, in the following format:

<div style="display:none;">
[cred_field field='@business-listing-review.parent' class='form-control' output='bootstrap' select_text='wpv-post-id' order='date' value='[wpv-post-id item="$current_page"]']
</div>
This support ticket is created 4 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)

Tagged: 

This topic contains 9 replies, has 2 voices.

Last updated by mikeF-8 4 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1328831
review.jpg

Tell us what you are trying to do?

A business listing with a post relationship for a review. The form is on the business listing page and also displays on the same page.

When the review posts, the post is created by not displaying on the listing where the review was made.

#1328917

Hi, can you take some screenshots of this View in wp-admin so I can see the configurations? Please be sure to include the Query Filter. If you cannot see the Query Filter section, scroll to the top right corner and click "Screen Options" to turn on the Query Filter panel. Include the screenshots with your next reply and I will take a look.

#1328935
VqkFGuVECT.png

Please see attached. Thank you.

#1328947

When the Review is created, is it linked to the Business Listing correctly in wp-admin?
If yes, try changing the View's post relationship query filter from "the current post in the loop" to the post where this View is displayed.

If no, the problem is most likely in the Form that creates Reviews. There should be a post relationship field in the Form, and the value should be set with the current post's ID using the wpv-post-id shortcode. You can hide the field with CSS if necessary.

#1328955
chrome_i3nRoy8PZF.png
chrome_Cd0boWcyXV.png

Ok I found the post relationship field. My form looks like this:

[credform]
[cred_field field='form_messages' class='alert alert-warning']
<div class="form-group ">
<label>Rating</label>
</div>
[cred_field field='@business-listing-review.parent' class='form-control' output='bootstrap' select_text='wpv-post-id' order='date']
<div class="form-group ">
<label>Rating</label>
</div>
[cred_field field='form_messages' class='alert alert-warning']
<div class="form-group ">
<label>Rating</label>
[cred_field scaffold_field_id='overall-rating' field='overall-rating' force_type='field' class='form-control' output='bootstrap' label='Rating']
</div>
<div class="form-group ">
<label>Review Title</label>
[cred_field scaffold_field_id='post_title' field='post_title' class='form-control' output='bootstrap' label='Review Title']
</div>
<div class="form-group ">
<label>Your Review</label>
[cred_field scaffold_field_id='review-content' field='review-content' force_type='field' class='form-control' output='bootstrap' label='Your Review']
</div>
[cred_field field='form_submit' output='bootstrap' value='Submit' class='et_pb_button']
[/credform]

I have two issues:

1. Please see screenshot. The relationship field is a menu that requires the parent post be selected. The reviews will always be on the same page as its parent. How do I get the review to be related to the current page?

2. Second screenshot... I have a new problem. The text of the review is apparently an infinite loop. No idea how i've even done that.

Thanks,

#1329005

1...The reviews will always be on the same page as its parent. How do I get the review to be related to the current page?
Use the wpv-post-id shortcode to set the value of this field to be identical to the ID of the current page. If you don't want to display this field to your visitors, wrap it in a div hidden with CSS. Here's a complete example of both:

<div style="display:none;">
[cred_field field='@business-listing-review.parent' class='form-control' output='bootstrap' select_text='wpv-post-id' order='date' value='[wpv-post-id item="$current_page"]']
</div>

2. Second screenshot... I have a new problem. The text of the review is apparently an infinite loop. No idea how i've even done that.
I'm not entirely sure, but it looks like you have a Content Template applied to this post. Then maybe you have added the same Content Template in the post content, or to a View inside the Content Template? I would have to take a closer look in wp-admin to see exactly what's happening. Please provide login credentials in the private reply fields here if you would like me to dig in deeper.

#1329041

Can you upgrade this User to be an admin? I'm not able to see any Toolset information in wp-admin now.

#1329043

Sorry. All set

#1329045
Screen Shot 2019-09-01 at 3.45.52 PM.png

The Template for the Listing Reviews View contains the Listing Reviews View, producing the infinite loop. Look here:
hidden link

You should remove the View shortcode from this template.

#1329055

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.