How to add Comments in Job Listings

In order to add comments within your job listing pages, you will need to carry out the following:

1. Add the code below within the functions.php file of the child theme:

// Add comment support to the job listing post type - you'll need to enable the comments for old listings manually
add_filter( 'register_post_type_job_listing', 'register_post_type_job_listing_enable_comments' );

function register_post_type_job_listing_enable_comments( $post_type ) {
	$post_type['supports'][] = 'comments';
	return $post_type;
}

// Make comments open by default for new job listings
add_filter( 'submit_job_form_save_job_data', 'custom_submit_job_form_save_job_data' );

function custom_submit_job_form_save_job_data( $job_data ) {
	$job_data['comment_status'] = 'open';
	return $job_data;
}

2. Navigate to your theme files under the Jobify>single-job_listing.php file and add the code below just after the content() function:

<?php comments_template(); ?>

Also ensure that you copy this file to the child theme under the same directory path.

3. Navigate to the Settings>Discussion section within your WordPress dashboard and allow commenting

4. For old job listings, you will need to also enable the comments support within the individual listings.

Was this article helpful?

Related Articles