{"id":11285279,"date":"2019-03-07T10:37:04","date_gmt":"2019-03-07T10:37:04","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/add-a-css-file-via-the-child-theme\/"},"modified":"2019-03-07T10:37:04","modified_gmt":"2019-03-07T10:37:04","slug":"add-a-css-file-via-the-child-theme","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/add-a-css-file-via-the-child-theme\/","title":{"rendered":"Add a CSS file via the child theme"},"content":{"rendered":"<p>I would like to add a custom CSS File to my OceanWP child theme but for some reason it isn&#8217;t loading.<\/p>\n<pre><code>function prefix_custom_styles() {\n\t\/\/ Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update your theme)\n\t$theme   = wp_get_theme( &#039;OceanWP&#039; );\n\t$version = $theme-&gt;get( &#039;Version&#039; );\n\n\twp_enqueue_style(&#039;flags&#039;, get_stylesheet_directory_uri() . &#039;\/flags\/flags.css&#039; );\n\n}\nadd_action( &#039;wp_enqueue_styles&#039;, &#039;prefix_custom_styles&#039; );<\/code><\/pre>\n<p>The above doesn&#8217;t work, can anyone see why? <\/p>\n<p>Thanks!<\/p>\n","protected":false},"template":"","class_list":["post-11285279","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11285279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11285279\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11285279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}