{"id":226,"date":"2021-01-09T16:52:30","date_gmt":"2021-01-09T14:52:30","guid":{"rendered":"https:\/\/wiki.dreid.ch\/?p=226"},"modified":"2021-01-09T16:52:30","modified_gmt":"2021-01-09T14:52:30","slug":"random-css","status":"publish","type":"post","link":"https:\/\/wiki.dreid.ch\/?p=226","title":{"rendered":"random css"},"content":{"rendered":"<p>\/**<br \/>\n * Enqueue scripts and styles for random version of stylesheet.<br \/>\n *\/<br \/>\nfunction cssrandom_scripts() {<br \/>\n\t$rand = rand(1, 99999999999);<br \/>\n\twp_enqueue_style( &#8216;html5blank-style&#8217;, get_stylesheet_uri(), &#8221;, $rand );<\/p>\n<p>\twp_style_add_data( &#8216;html5blank-style&#8217;, &#8216;rtl&#8217;, &#8216;replace&#8217; );<\/p>\n<p>\tif ( is_singular() &#038;&#038; comments_open() &#038;&#038; get_option( &#8216;thread_comments&#8217; ) ) {<br \/>\n\t\twp_enqueue_script( &#8216;comment-reply&#8217; );<br \/>\n\t}<br \/>\n}<br \/>\nadd_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;cssrandom_scripts&#8217; );<\/p>\n<p>\/*add category class in body*\/<br \/>\nadd_filter(&#8216;body_class&#8217;,&#8217;add_category_to_single&#8217;);<br \/>\n  function add_category_to_single($classes) {<br \/>\n    if (is_single() ) {<br \/>\n      global $post;<br \/>\n      foreach((get_the_category($post->ID)) as $category) {<br \/>\n        \/\/ add category slug to the $classes array<br \/>\n        $classes[] = $category->category_nicename;<br \/>\n      }<br \/>\n    }<br \/>\n    \/\/ return the $classes array<br \/>\n    return $classes;<br \/>\n  }<\/p>\n<p>\/**<br \/>\n * End of Enqueue scripts and styles for random version of stylesheet.\/**\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/** * Enqueue scripts and styles for random version of stylesheet. *\/ function [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-226","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/posts\/226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=226"}],"version-history":[{"count":1,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/posts\/226\/revisions"}],"predecessor-version":[{"id":227,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/posts\/226\/revisions\/227"}],"wp:attachment":[{"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}