Skip Navigation

[Gelöst] Comments appearing under all blogs

This support ticket is created vor 6 Jahre, 7 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

This topic contains 8 Antworten, has 2 Stimmen.

Last updated by Christian Cox vor 6 Jahre, 7 Monate.

Assisted by: Christian Cox.

Author
Artikel
#570188

I am trying to create a comment form and view the comments for that blog only. I have created the child post type comments for the posts post type and i submitted a comment on one blog, but it shows on all the other blogs too.

hidden link
hidden link

#570237

Hi can you share some more information with me?
- Is your CRED form configured to associate each Comment with a parent post? If so, how?
- Can you share the Query Filter settings for the View of Comments? There should be a post relationship filter applied, and the View should show posts that are children of the current post.

#570381
toolset.jpg

I have it set through the post type under child.

Here are my view settings.

#570391

I have it set through the post type under child.
This sounds like how you have configured the post relationship in the parent post type editor, is that correct? If so, you must also modify your CRED form to include inputs that allow you to define the parent post. Once you have established the post relationship in the parent post type editor, go to the CRED form editor for your child post form and use the Auto-generate code button to update your form inputs. This will cause a new field to appear in your form, where the user can select a parent post.

In your case, we don't want the user to select a parent post. We want to predefine the parent post. So you must make an adjustment to the automatically generated code. Find the cred_field shortcode that generates the parent post and modify the value attribute to match as shown below:

[cred_field field='_wpcf_belongs_parent-post-type-slug_id' value='[wpv-post-id id="$current_page"]' select_text='--- not set ---' class='form-control' output='bootstrap']

When you add the wpv-post-id shortcode with the $current_page operator, this will instruct the parent select field to be preset to the current parent post's ID. This will predefine the parent post correctly.

If you want to hide this input completely so users cannot select other parents, you can add some CSS to the surrounding form group div that will hide this entire block:

<div class="form-group" style="display:none;">
  <label>parent-post-type-slug Parent</label>
  [cred_field field='_wpcf_belongs_parent-post-type-slug_id' value='[wpv-post-id id="$current_page"]' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>

Here are my view settings.
As I mentioned before, you must modify the Query Filter here to include a post relationship filter. It should be configured to show only children of the current post. Otherwise, all comment posts will be shown on all parent posts.

Let me know if you have additional questions about these.

#570423
Screen Shot 2017-09-15 at 11.18.19 AM.png
Screen Shot 2017-09-15 at 11.16.25 AM.png
Screen Shot 2017-09-15 at 11.16.05 AM.png

Im not sure if I did it right but here are some more screenshots.

#570433

Okay if the native Post type is the parent post type, you must modify the code to use the correct field name, which is _wpcf_belongs_post_id as shown here:

<div class="form-group" style="display:none;">
  <label>Post Parent</label>
  [cred_field field='_wpcf_belongs_post_id' value='[wpv-post-id id="$current_page"]' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>
#570450

I went ahead and replaced the other code with that but it still didn't work. I can send you login creds.

#570752

Private reply fields are enabled here.

#570837

I don't think the replaced code was saved correctly, because when I logged in the code was still:

<div class="form-group" style="display:none;">
      <label>parent-post-type-slug Parent</label>
      [cred_field field='_wpcf_belongs_parent-post-type-slug_id' value='[wpv-post-id id="$current_page"]' select_text='--- not set ---' class='form-control' output='bootstrap']
  </div>

I replaced that code with:

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

Then I submitted the form here:
/why-real-estate-agents-change-brokerages
I can now see my comment appear above the form here, but not on other posts like /6-tips-keep-pets-safe-halloween/

Can you try a test comment and confirm the comment is appearing correctly now?

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