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.
Tell us what you are trying to do?
I want to build a custom comment system for my toolset created custom post types. The fields I would have would be the same as the default comment system. I would like to add a checkbox with the numbers 1-5 then using CSS change those checkboxes into stars for a rating. This will be my "rating" for my custom post that the user is commenting on.
1.) How to limit the user from submitting more than 1 rating per custom content but allow them to submit more than one comment per post. Ideally I would want only one rating per post per user and I'm not sure how to accomplish this.
2.) Keep the rating associated with the custom post so that I can use the date in a view somewhere else on the website.
3.) Calculate an average rating per custom post for an "overall" total.
Is there any documentation that you are following? No
Is there a similar example that we can see? No
What is the link to your site?
4.) I also am not sure how to associate the comments with the individual page. I need to have the view associate the comments with the current page id or url.
Sorry I wanted to update this as I progress:
It seems that with Toolset I can associate custom post types using "Relationships".
I've decided to make a relationship between "Twitch Channels" and "Twitch Comments" custom post types where Twitch channel can have infinite Twitch Comments.
I've created a View to display the output of a Form I made to take in the comment information. In this view I did a query and told it to "Select posts in Any relationship that are related to the Post where this View is shown. " and I've included the View on my Content Template page where the Twitch Channel is.
Using this information:
I am trying to connect the two custom post types so the comment can be displayed on the correct page but it doesn't seem to be working properly and I'm stumped at this point.
Doing some testing and looking over this post:
The information is automatically passed to the field until I use css to make the div hidden. Then it doesn't seem to pass the information when I submit the form.
Languages: English (English ) Chinese (Simplified) (简体中文 )
Timezone: Asia/Hong_Kong (GMT+08:00)
Q1) and Q2) You can setup another post type "rating", setup one-many-relationship between post type between "Twitch Channels" and "rating".
In single "Twitch Channels" post, display a post view:
- Query "rating" post,
- Filter by:
Select posts with the author the same as the current logged in user.
- in section "Loop Editor", within shortcode [wpv-no-items-found] ... [/wpv-no-items-found], display a child form link for creating child "rating" post.
Q3) Calculate an average rating per custom post for an "overall" total.
There isn't such kind of built-in feature within Toolset plugins, you might consider custom codes, for example, you can create a custom shortcode
in this shortcode, get all related "rating" posts by current "Twitch Channels" post ID:
The use related "rating" posts to calculate the average ratting value.
Q4) I also am not sure how to associate the comments with the individual page.
Yes, you are referring correct document:
For the problem: Then it doesn't seem to pass the information when I submit the form.
I suggest you try to follow above document to setup the form and link, steps by steps.
if you need more assistance for it, please provide a test site with the same problem, also point out the problem page URL and form URL, I can try to setup a demo for you. thanks
Thanks for the reply and sorry for my delayed response. I had to fly out of the country for work for three days.
I managed to get the select field to populate the correct value and hide it using this documentation I found:
I also did as you suggested with the post relationships and now my comments are displaying correctly due to the relationships being assigned properly now.
My next step is to make the "rating" custom post type and get that to work properly.
Thanks for your help with this.
New threads created by Minesh and linked to this one are listed below:
Languages: English (English )
Timezone: Asia/Kolkata (GMT+05:30)
Luo is on vacation. This is Minesh here and I'll take care of this ticket. Hope this is OK.
Thanks for the confirmation that what Luo suggested works to implement the comment system. As per our support policy, we entertain only one question per ticket, this will help other users searching on the forum as well as help us to write correct problem resolution summery.
I'll split the ticket for your additional rating functionality. Please feel free to close this ticket.
My issue is resolved now. Thank you!