{"id":1185,"date":"2017-02-14T07:16:11","date_gmt":"2017-02-14T07:16:11","guid":{"rendered":"http:\/\/docs.contentviewspro.com\/?p=1185"},"modified":"2023-12-29T03:23:24","modified_gmt":"2023-12-29T03:23:24","password":"","slug":"fix-issue-element-style-not-allowed-child-element-div-context","status":"publish","type":"docs","link":"https:\/\/contentviewspro.com\/documentation\/article\/fix-issue-element-style-not-allowed-child-element-div-context\/","title":{"rendered":"Fix: &#8220;Element style not allowed as child of element div in this context&#8221;"},"content":{"rendered":"<p>Please follow 2 steps below:<\/p>\n<p>1. add this code to file <strong>functions.php<\/strong> of your active theme:<\/p>\n<pre style=\"font-size: 13px;\">\/\/ Content Views Pro - Disable print inline CSS, will print it at footer\nadd_filter( 'pt_cv_inline_view_style', '__return_false' );\n\n\/\/ Content Views Pro - Fix HTML validator issue \"Element style not allowed as child of element body in this context\"\nadd_filter( 'pt_cv_delayed_css', 'cvp_theme_delayed_css', 100, 1 );\nfunction cvp_theme_delayed_css( $args ) {\n\t$args = str_replace( array( '&lt;style type=\"text\/css\"', 'style&gt;' ), array( '&lt;div style=\"display:none\" data-type=\"cvpcss\"', 'div&gt;' ), $args );\n\treturn $args;\n}\n<\/pre>\n<p>2. add this code to <strong>Custom JS<\/strong> field in Content Views &gt;&gt; Settings page:<\/p>\n<pre style=\"font-size: 13px;\">$('[data-type=\"cvpcss\"]').each(function(){var t=$(this).html(),e='&lt;style type=\"text\/css\" class=\"cvpstyle\"&gt;'+t+\"&lt;\/style&gt;\";$(\"head\").append(e),$(this).remove()});<\/pre>\n<p>Best regards,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Please follow 2 steps below: 1. add this code to file functions.php of your active theme: \/\/ Content Views Pro &#8211; Disable print inline CSS, will print it at footer add_filter( &#8216;pt_cv_inline_view_style&#8217;, &#8216;__return_false&#8217; ); \/\/ Content Views Pro &#8211; Fix HTML validator issue &#8220;Element style not allowed as child of element body in this context&#8221; &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/contentviewspro.com\/documentation\/article\/fix-issue-element-style-not-allowed-child-element-div-context\/\"> <span class=\"screen-reader-text\">Fix: &#8220;Element style not allowed as child of element div in this context&#8221;<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"doc_category":[23],"doc_tag":[21],"class_list":["post-1185","docs","type-docs","status-publish","hentry","doc_category-common-bugs","doc_tag-custom-code"],"year_month":"2026-09","word_count":150,"total_views":"2","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"admin1","author_nicename":"admin1","author_url":"https:\/\/contentviewspro.com\/documentation\/author\/admin1\/"},"doc_category_info":[{"term_name":"Troubleshooting","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/common-bugs\/"}],"doc_tag_info":[{"term_name":"custom PHP code","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/custom-code\/"}],"_links":{"self":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/comments?post=1185"}],"version-history":[{"count":2,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1185\/revisions"}],"predecessor-version":[{"id":5604,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1185\/revisions\/5604"}],"wp:attachment":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/media?parent=1185"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=1185"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=1185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}