Enable comments on custom page type – option not showing in “customize” for theme

I have created a custom page type, and I would like users to be able to comment on it. At first blush this is similar to Comments not showing in custom post type – WordPress, however I am setting the ‘supports’ value with ‘comments’:

public function createEpisodeType() {
$labels = array(
‘name’ => ‘Episodes’,
‘singular_name’ => ‘Episode’,
‘menu_name’ => ‘Episodes’,
‘name_admin_bar’ => ‘Episode’,
‘add_new’ => ‘Add New’,
‘add_new_item’ => ‘Add New Episode’,
‘new_item’ => ‘New Episode’,
‘edit_item’ => ‘Edit Episode’,
‘view_item’ => ‘View Episode’,
‘all_items’ => ‘All Episodes’,
‘search_items’ => ‘Search Episodes’,
‘parent_item_colon’ => ‘Parent Episode’,
‘not_found’ => ‘No Episodes Found’,
‘not_found_in_trash’ => ‘No Episodes Found in Trash’,
);

$args = array(
‘labels’ => $labels,
‘public’ => true,
‘exclude_from_search’ => false,
‘publicly_queryable’ => true,
‘show_ui’ => true,
‘show_in_nav_menus’ => true,
‘show_in_menu’ => true,
‘show_in_admin_bar’ => true,
‘menu_position’ => 5,
‘menu_icon’ => ‘dashicons-admin-appearance’,
‘capability_type’ => ‘page’,
‘hierarchical’ => true,
‘supports’ => array( ‘page-attributes’, ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘comments’, ‘revisions’ ),
‘has_archive’ => true,
‘rewrite’ => array( ‘slug’ => ‘episode’, ‘with_front’ => false ),
‘query_var’ => true,
‘description’ => ‘Page type that has a sequence’,
);

register_post_type(self::post_type_slug, $args);
}

When I use Debug This to inspect current query, I see the post data, including

[comment_status] => open

I suspect the problem is with the theme customization. When I look at the comments.php file for the theme I am using, I see this right at the top:

$comments_display = get_theme_mod( ‘comments_display’ );
$post_type = get_post_type();

if ( is_array( $comments_display ) ) {

if ( ! in_array( $post_type, $comments_display ) ) {
return;
}
}

I directly inspected the options in the database, I see that ‘comments_display’ is an array of three values – ‘post’, ‘page’, and ‘none’. My custom type is not in that list. That seems like the root of the problem to me.

I went to the Customize: Comment Display section for my theme, but the options did not include my new content type.

Is there a way to get my custom type to show up in that list? I’m assuming the theme calls some standard function to get a list of content types, and that I need to do something to get my type on that list.

Read more here:: Enable comments on custom page type – option not showing in “customize” for theme

Leave a Reply

Your email address will not be published. Required fields are marked *