• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Add Comments Form On Single Custom Post Type Pages

Generally, single pages assigned to a custom post type don’t normally include a comment form.

Update : This solution is no longer needed as Genesis now includes support for comments on all custom post types.

You may find code in the single CPT template file which removes the comments form which you can remove.

//* Remove the comments template
remove_action( 'genesis_after_entry', 'genesis_get_comments_template' );

Otherwise there’s 2 ways to add support for comments to custom post type pages.

Paste this code at the end of your child themes functions.php file:

add_post_type_support( 'portfolio', 'comments' );

Simply change the name from portfolio in the code to the name of your custom post type (CPT).

For non Genesis users, you can use this code in your functions file:

function enable_comments_custom_post_type() {
 add_post_type_support( 'portfolio', 'comments' );
}
add_action( 'init', 'enable_comments_custom_post_type', 11 );

Second Option

Add support for comments to your existing CPT code in your functions file: Example:

In the code block above, you can add comments to the array your CPT supports.

'supports'     => array( 'comments',

Now you should find comments are supported in the backend Edit Page of all your single CPT’s.

comments

The only problem is, the actual comment form may not be displaying.

The reason for this is, you also need to enable comments manually on each single CPT regardless of your Discussion settings.

allow comments

Once you do this, you will then see the comment form on your single custom post type pages.

Related Code Snippets

  • Open Comments On All or Any WordPress Post Type Globally

Comments Custom Post Type

Reader Interactions

Comments

  1. Heidi Bender says

    April 28, 2014 at 2:41 pm

    This was exactly what I needed. thank you!!!

    Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.