Fix issue “Element style not allowed as child of element div in this context” from validator.w3.org

By default, custom style of each View is shown below the View, as child of a div element. And it is reason of this error reported by validator.w3.org. This is a false positive issue, and it will NOT affect your SEO rank or anything else. But if you want to remove this error, please follow 2 steps below:

1. add this code to file functions.php of your active theme:

// CVPro - Disable print inline CSS, will print it at footer
add_filter( 'pt_cv_inline_view_style', '__return_false' );

// CVPro - Fix HTML validator issue "Element style not allowed as child of element body in this context"
add_filter( 'pt_cv_delayed_css', 'cvp_theme_delayed_css', 100, 1 );
function cvp_theme_delayed_css( $args ) {
	$args = str_replace( array( '<style type="text/css"', 'style>' ), array( '<div style="display:none" data-type="cvpcss"', 'div>' ), $args );
	return $args;
}

2. add this code to Custom JS field in Content Views >> Settings page:

$('[data-type="cvpcss"]').each(function(){var t=$(this).html(),e='<style type="text/css" class="cvpstyle">'+t+"</style>";$("head").append(e),$(this).remove()});

Best regards,