Skip Navigation

[Gelöst] Combining Types, Views & Cred to create a star review component of website

This support ticket is created vor 8 Jahre. 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 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 Antworten, has 2 Stimmen.

Last updated by Dat Hoang vor 8 Jahre.

Assigned support staff: Dat Hoang.

Author
Artikel
#275236

I have read this page for guidance and the below forum post along with others:
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/
https://toolset.com/forums/topic/how-to-get-rating-average-from-cred-for-review/

. . .

I am trying to: create a review component to the website here: hidden link

I've create a new custom post type vendor-review (singular) and it is a 'child' of the parent custom post type vendor. Vendor review has several custom fields to display of which one is a select type for 'star' rating from 1 through 5. I will try to update this to show 1 through 5 star images but for now shows the numeric value.

I have a custom template specifically for vendors and on the singular vendor content template I want to do two things:

1. display a CRED box allowing viewers to leave a review
2. show all reviews relevant to the vendor.

I have one entry which has the vendor post type content, the views content template filled in and the sections ready to show the 'reviews', I also have a CRED form specifically for vendor reviews which had the form auto generated and I added the top links from the guidance here:

I visited this URL: hidden link

I expected to see: the CRED form link (this worked) and when you click the link it displays all the shortcode text but not the form.

Also I wanted the actual form to show on the vendor single page, instead of a link.

Plus I wanted all the relevant reviews to show.

Instead, I got:

The content template (great) but no CRED form or relevant reviews to show.

. . .

Here is my setup & code:

TYPE:
Custom Post Type: vendor
Custom Post Type: vendor-review - only uses the Title option of the custom post type, no other options are selected eg. No Editor or comments etc.

Custom Fields for vendor-review:
Reviewer Name - Single line field
Reviewer Email - Email field
Star Rating - Select field
Vendor Review - Multiple lines field

VIEW - Vendor Review as a Single Post Type.

Query set as: Post type Vendor Review is a child of vendor post type

<wpv-loop>
          <div class="one-quarter first">[types field="star-rating"][/types]</div>
          <div class="three-quarters">          <h5>[wpv-post-title] ...</h5>
          <p>[types field="reviewer-name"][/types]</p>
          <p>... [types field="vendor-review"][/types]</p>
          </div>
		</wpv-loop>

CRED Form:

[credform class="cred-form cred-keep-original"]

	[cred_field field="form_messages" value=""]

<div class="vendorsupplier">
      
  <h2>You're currently reviewing: [cred-post-parent get='title']</h2>
  <a href="[cred-post-parent get='url']">Back to: [cred-post-parent get='title']</a>
      
      
	</div>

	<div class="cred-field cred-field-post_title">
		<label class="cred-label">
Vendor Review Name
</label>
		[cred_field field="post_title" post="vendor-review" value="" urlparam=""]
	</div>

	<div class="cred-group cred-group-Vendor-Reviews">
		<div class="cred-header"><h3>Vendor Reviews</h3></div>
		<div class="cred-field cred-field-reviewer-name">
			<label class="cred-label">
Reviewer Name
</label>
			[cred_field field="reviewer-name" post="vendor-review" value="" urlparam=""]
		</div>
		<div class="cred-field cred-field-reviewer-email">
			<label class="cred-label">
Reviewer Email
</label>
			[cred_field field="reviewer-email" post="vendor-review" value="" urlparam=""]
		</div>
		<div class="cred-field cred-field-star-rating">
			<label class="cred-label">
Star Rating
</label>
			[cred_field field="star-rating" post="vendor-review" value="" urlparam=""]
		</div>
		<div class="cred-field cred-field-vendor-review">
			<label class="cred-label">
Vendor Review
</label>
			[cred_field field="vendor-review" post="vendor-review" value="" urlparam=""]
		</div>
	</div>

	<div class="cred-group cred-group-parents">
		<div class="cred-field cred-field-_wpcf_belongs_vendor_id">
			<label class="cred-label">
		vendor Parent
		</label>
			[cred_field field="_wpcf_belongs_vendor_id" value=""]
		</div>
		
	</div>

	[cred_field field="form_submit" value="Submit" urlparam=""]

[/credform]

As the CRED form is creating a new review for a predefined parent custom post type, is there a way to show but disable the drop down selector for 'parent'? This way visitors can only see the form when sent to it from the vendor page, and not the other way around by selecting a vendor to review.

Thank you.
Cathie.

#275319

#1,
Your Toolset plugin versions looks up-to-date.
If you disable all non-related Toolset plugins, switch to one of default themes, the problem persists or not?

#2,

 is there a way to show but disable the drop down selector for 'parent'? 

==>Yes, of course. You just need to remove the cred_field shortcode relate to this. In this case, it's

            [cred_field field="_wpcf_belongs_vendor_id" value=""]
#275373

#2: sorted, thank you.

#1: I turned off all the plugins except the Types, Views & Cred plugins and also changed the theme to the twentyfifteen and it made no change.

I can get the CRED form to show correctly now, it self corrected over night .. strange but okay.

Lastly I can't get the reviews to show up underneath the single vendor listing, despite posting the views shortcode at the very bottom of the content template.

[wpv-view name="Vendor - Review Ratings & Comments"]

. . .

Also I've further questions about CRED, and making all vendor reviews set to the vendor posts' user, while also locking the review so that a vendor user is not able to fabricate their own reviews within the system, to lock down their editing rights of reviews to only be able to view them under their listing in the admin section. Should I launch a new support case for that?

#275540

Great to hear that works.

Yes, I suggest you open a new ticket for the new thing.

I am marking this ticket "Resolved".

Thank you.
Dat