Notifications
Clear all

[Solved] wpDiscuz not showing on Custom Post Type

21 Posts
6 Users
1 Likes
18.3 K Views
(@michaelautin)
Active Member
Joined: 7 years ago
Posts: 8
Topic starter  

Hello,

I am using a Knowledge Base Plugin which crates a CPT hr_kb. This post is selected in the form admin area to show wpDiscuz. But it continues to show the default comment form.

I followed all suggestions in this thread:  https://gvectors.com/forum/how-to-and-troubleshooting/resolved-wpdiscuz-comment-form-is-missing/paged/1/

I even placed <?php comments_template() ?> inside the CPT single template. But it still shows the default form.

Please help me on this. Since it is rather urgent I would gladly pay for your support in finding a solution directly on my site.

Best Michael


   
Quote
 Tom
(@tomson)
Famed Member Admin
Joined: 9 years ago
Posts: 4171
 

Please check the 3rd page of this topic, it seems you've not enabled comment form for this custom content type: https://gvectors.com/forum/how-to-and-troubleshooting/resolved-wpdiscuz-comment-form-is-missing/paged/2/#post-2751


   
ReplyQuote
(@michaelautin)
Active Member
Joined: 7 years ago
Posts: 8
Topic starter  

Hello, as I specifically mentioned this has been done 😉

 
Posted by: michaelautin

This post is selected in the form admin area to show wpDiscuz. But it continues to show the default comment form.

If you could enable private feedback I would gladly give you access to check this on site.

Michael


   
ReplyQuote
(@michaelautin)
Active Member
Joined: 7 years ago
Posts: 8
Topic starter  

Hi again, I was in the meantime able to resolve this. The problem was with the Knowledgeable plugin. 

thx though 


   
FTLRalph reacted
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 9 years ago
Posts: 4171
 

Thank you for letting us know.


   
ReplyQuote
(@ftlralph)
Active Member
Joined: 7 years ago
Posts: 8
 
Posted by: michaelautin

Hi again, I was in the meantime able to resolve this. The problem was with the Knowledgeable plugin. 

thx though 

hey Michael, if you can, do you mind letting me know what the issue was?

I'm having the exact same problem (default comment form shows only on specific post type, even though post type is checked/form is re-saved) with plugin WP-Filebase.


   
ReplyQuote
(@ftlralph)
Active Member
Joined: 7 years ago
Posts: 8
 

In a desperate attempt for an answer, I'm going to click "Reply" under your comment in case that notifies you of a new reply lol. See comment above.


   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 9 years ago
Posts: 4171
 

Hi FTLRalph,

Are you sure this content type supports comments? Please deactivate wpDiscuz and check it the default comment form appears on this custom content type pages.


   
ReplyQuote
(@michaelautin)
Active Member
Joined: 7 years ago
Posts: 8
Topic starter  

Hi Ralph,

yes that worked 😉 Did not see your first reply.

The first time I got it to work I just manually placed this inside the template file where I wanted the comments to appear. <?php comments_template() ?>

The following is the explanation and hopefully better solution provided by  https://www.dev4press.com another Knowledge Base plugin I switched to in the meantime. ( I have not yet tried this)

"The reason why the WPDiscuz doesn't work with my plugin compatibility mode is on the WPDiscuz side, and will not work with any other plugin using similar technique (bbPress, BuddyPress, WooCommerce...). This plugin checks for the replacement of the comment form when page is starting to load on wp_head action. If this action is replaced with earlier action: wp (that runs before template is loaded), plugin works with my plugin and with any theme using my plugin:

wpdiscuz plugin => file 'class.WpdiscuzCore.php', line 62 replace:
 
add_action('wp_head', array(&$this, 'initCurrentPostType'));
 
with 

 

add_action('wp', array(&$this, 'initCurrentPostType')); "

Let me know if that works for you!


   
ReplyQuote
(@ftlralph)
Active Member
Joined: 7 years ago
Posts: 8
 

Hey michael thanks for that. I really thought that would be it but unfortunately nothing seems to have changed. It could be the solution for your problem, even though mine is similar it is a different plugin (WP Filebase).

In one last desperate attempt at a quick fix, when you mention <?php comments_template() ?>, do you mean you manually placed that inside a plugin file - a Knowledgebase file or WwpDiscuz file?

As it stands it seems my plugin here utilizes the themes Single.php file to render these custom posts, and that Single.php file already uses <?php comments_template() ?> to show comments, so not sure if this is even relevant for me.

Thanks anyway though appreciate the help.


   
ReplyQuote
(@ftlralph)
Active Member
Joined: 7 years ago
Posts: 8
 
Posted by: Tom

Hi FTLRalph,

Are you sure this content type supports comments? Please deactivate wpDiscuz and check it the default comment form appears on this custom content type pages.

Hi, it does. It displays the default comment form before/after enabling wpDiscuz even though I have the wpfb_filepage post type checked in "Forms" and have verified this plugin uses Single.php in the theme, which uses <?php comments_template() ?> as well.


   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 9 years ago
Posts: 4171
 
Posted by: michaelautin

wpdiscuz plugin => file 'class.WpdiscuzCore.php', line 62 replace:
add_action('wp_head', array(&$this, 'initCurrentPostType'));
with
add_action('wp', array(&$this, 'initCurrentPostType')); "
Let me know if that works for you!

 

Ok, thank you, we'll take this under consideration.


   
ReplyQuote
(@ftlralph)
Active Member
Joined: 7 years ago
Posts: 8
 
Posted by: Tom
Posted by: michaelautin

wpdiscuz plugin => file 'class.WpdiscuzCore.php', line 62 replace:
add_action('wp_head', array(&$this, 'initCurrentPostType'));
with
add_action('wp', array(&$this, 'initCurrentPostType')); "
Let me know if that works for you!

 

Ok, thank you, we'll take this under consideration.

Hi Tom, sorry to be annoying but would you have any ideas what could be causing this or what to look at? I'd contact the WP-Filebase dev but he's missing in action (see opening post). Thanks.


   
ReplyQuote
(@ftlralph)
Active Member
Joined: 7 years ago
Posts: 8
 

For what it's worth, I was able to get it working by changing this line in class.WpdiscuzHelper.php:

return $form->getFormID() && (comments_open($post) || $post->comment_count) && is_singular() && post_type_supports($post->post_type, 'comments');

And removing the last bit: post_type_supports($post->post_type, 'comments');

For whatever reason, even though the wpfb_filepage post type is registered like this...

register_post_type('wpfb_filepage', array(
        'labels' => array(
            'name' => __('Files', 'wp-filebase'),
            'singular_name' => __('File', 'wp-filebase')
        ),
        'label' => __('Files', 'wp-filebase'),
        'show_ui' => true,
        'show_in_menu' => false,
        'show_in_nav_menus' => true,
        'public' => true,
        'has_archive' => false,
        'rewrite' => array('slug' => WPFB_Core::$settings->file_page_url_slug, 'with_front' => WPFB_Core::$settings->file_page_url_wfront), //WPFB_Core::$settings->file_post_type_slug),
        'supports' => array(
            'comments' => WPFB_Core::$settings->file_page_comments,
            'title' => true, // displayed when editing
            'editor' => true,
            ...

...with WPFB_Core::$settings->file_page_comments being TRUE, this one check always produced false? I'd like to check what the value of "supports comments" is in the database for this post type, but I don't know where to look.

I figured if comments_open() is true that's good enough of a check for me here.


   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 9 years ago
Posts: 4171
 

As far as I see your new post type doesn't support comments. Instead of this change it would be better to add a small code in functions.php of your active theme to enable comments for this post type. This kind of code may be found in internet or you could ask a support question to the post type creator plugin support team.


   
ReplyQuote
 timo
(@timo)
New Member
Joined: 6 years ago
Posts: 3
 

Hi,

your plugin has definitely an issue with custom post types. As it works on my default posts but not on a custom post type set up with plugin "Custom Post Type UI" ( https://de.wordpress.org/plugins/custom-post-type-ui/) and configured to support comments, just the default comments  form appears on that custom post type pages. I walked through all the tips in this thread and  https://wpdiscuz.com/docs/wpdiscuz-documentation/getting-started/missing-comment-form/ without success.

Then I went deep into the code. The issue is related to the variables $formPostRel and $formContentTypeRel in class wpDiscuzForm. The first one just contains post, page and attachment. The second contained nothing, so function "getForm" of the same class is not able to determine the $formID for my custom post type and returns 0. This causes a chain reaction: the frontend stuff can not be loaded, your plugin "thinks" it is not initialized and does not overwrite the template file in WP internal function "comments_template" at apply_filters( 'comments_template', $theme_template).

I found out that the mentioned variable $formContentTypeRel which should contain my custom post type gets populated by class WpdiscuzOptionsSerialized from serialized options stored in wp_options table as "wpdiscuz_form_content_type_rel". As I did not figure out how this value can be changed via your plugin's admin panel, I manually added my custom post type to the serialized string and now it works (the default wpdiscuz form ID can be determined).

Could you please check this behavior? Because I am afraid that the serialized options value will be overwritten again by your plugin and my custom post type will be removed again.

This post was modified 6 years ago by timo

   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5911
 

Hi @timo,

you just need to navigate to Dashboard > Comments > Forms, edit the Default Form make sure it's enabled for all post types, save it then do Ctrl+F5 on front-end.

Check Tip1 in this support topic: 

https://gvectors.com/forum/how-to-and-troubleshooting/resolved-wpdiscuz-comment-form-is-missing/


   
ReplyQuote
 timo
(@timo)
New Member
Joined: 6 years ago
Posts: 3
 

Wow, thanks! Why is this not documented on the above mentioned documentation page? I didn't plan on having to search the forum.

This post was modified 6 years ago by timo

   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5911
 

@timo,

Please take a look at Fixing Tip 2

tip2

   
ReplyQuote
 timo
(@timo)
New Member
Joined: 6 years ago
Posts: 3
 

Thanks, I must have overseen this. I was just checking the options sections of your plugin and did not recognize the subsection "Forms". Maybe you can place a special hint regarding custom post types in the options section.


   
ReplyQuote
Page 1 / 2
Share:
Scroll to top