Add body classes to specific page templates in WordPress

Adding a body class to specific page template in WordPress, put the below snippet inside the functions.php

<?php
//Add 'archive' class to body tag of specific page templates (those that work as archives)
	function add_archive_classes_to_page_templates($classes) {
		if (is_page_template('news.php')) {
			$classes[] = 'archive';
		}
			return $classes;
	}
	add_filter('body_class', 'add_archive_classes_to_page_templates');
?>