Skip Navigation

[Resolved] How to create comments like on facebook wall

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 13 replies, has 3 voices.

Last updated by Shane 6 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#516467

I'm building a site where i need to comment on posts in a view loop. Very much like a facebook wall. I have all the posts displayed in my view. I have created a post type with my comments. I have relationship working, so my comments belong to the right post in the loop.

My problem is that all the forms with comment got the same id, so when i press "Submit" everything fucks up 🙂

#516601

Hello Brian,

There's a post about this and might work:

https://toolset.com/forums/topic/using-the-comments-shortcode-within-a-view/

You should add to your functions.php the following code:

 

add_shortcode('wpv-post-comments', 'my_post_comments');
function my_post_comments() {
if(get_post_type( get_the_ID()) == "my-type")
{
ob_start();
comments_template();
$data = ob_get_clean();
return $data;
}
}
 
//Replace "my-type" with your custom post type slug

#516639

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Brian,

Thank you for contacting our support forum.

Also thank you Martin for sharing your code. @brian was this able to assist you?

Please let me know.

Thanks,
Shane

#516649

Martin thank you very much for your input.

I need the comment to be a custom post type to ( got extra fields), and not the default wordpress comments... I don't think that is possible from the code... Please correct me if I'm wrong.

Any other suggestions?

#516668

I actually found out that it is only the ajax submission that doesn't work... It saves the comment, but when it tries to substitute the form with a text messages, it targets all the instances of the form.

#516671

Ok... this is bugged 🙂 the ajax call saves the first instance of the form. Not the one where submit is clicked...

#516995

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Brian,

Could you let me know the code you are using to add the comments ?

It could be that the id needs to be provided so it knows which post it should add the comment for.

Thanks,
Shane

#517006

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

[cred_field field='form_messages' value='']

<div class="cred-group cred-group-Comment-jobs">

<div class="cred-field cred-field-commentjob">
<label class="cred-label">
Kommenter
</label>
[cred_field field='commentjob' post='comment-job' value='' urlparam='']
</div>
</div>

<div style="display:none;">
[cred_field field='_wpcf_belongs_job_id' value='[wpv-post-id id="$job"]']
</div>

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

[/credform]

#517007

And from the view loop:

[cred_form form='comment-job' form_name='Comment job']

Please remember that this works if i turn off ajax

#517016

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Brian,

Ok I see so you're posting the comments in a separate CPT and relating it to the post .

Would you mind providing me with admin access to the website so that I can have a look ?

The private fields will be enabled for your next response.

Thanks,
Shane

#517051

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Brian,

Thanks for the credentials.

I was able to replicate the issue in a fresh install and will be escalating this issue to our 2nd tier supporters for further debugging

Thanks,
Shane

#517928

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Brian,

It seems that this issue has been resolved in a upcoming version of CRED that will be released sometimes next week.

Thanks,
SHane

#517931

This is perfect... Thanks for your help 🙂

#528041

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Brian,

We have released our latest version of CRED.

Please try and let me know if the update helps.

Thanks,
Shane

The forum ‘Types Community Support’ is closed to new topics and replies.

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