{"id":1692,"date":"2019-03-13T22:38:07","date_gmt":"2019-03-13T13:38:07","guid":{"rendered":"http:\/\/4koma-web.com\/coding\/?p=1692"},"modified":"2019-03-13T22:38:07","modified_gmt":"2019-03-13T13:38:07","slug":"wordpress%e3%81%a7%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ab%e5%80%8b%e5%88%a5css%e3%82%92%e8%bf%bd%e5%8a%a0%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/4koma-web.com\/coding\/wordpress%e3%81%a7%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ab%e5%80%8b%e5%88%a5css%e3%82%92%e8%bf%bd%e5%8a%a0%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/","title":{"rendered":"WordPress\u3067\u30da\u30fc\u30b8\u306b\u500b\u5225CSS\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>WordPress\u3067\u30da\u30fc\u30b8\u306b\u500b\u5225CSS\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p>\u30e1\u30a4\u30f3\u30c6\u30fc\u30de\u306eCSS\u3092\u635c\u67fb\u3057\u3066\u307b\u3057\u304f\u306a\u3044\u5834\u5408\u3084\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3054\u3068\u306b\u500b\u5225\u306bCSS\u3092\u5f53\u3066\u305f\u3044\u3068\u3044\u3063\u305f\u5834\u5408\u306b\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<pre>\r\nadd_action('admin_menu', 'custom_css_hooks');\r\nadd_action('save_post', 'save_custom_css');\r\nadd_action('wp_head','insert_custom_css');\r\nfunction custom_css_hooks() {\r\n    add_meta_box('custom_css', 'Custom CSS', 'custom_css_input', 'post', 'normal', 'high');\r\n    add_meta_box('custom_css', 'Custom CSS', 'custom_css_input', 'page', 'normal', 'high');\r\n}\r\nfunction custom_css_input() {\r\n    global $post;\r\n    echo '<input type=\"hidden\" name=\"custom_css_noncename\" id=\"custom_css_noncename\" value=\"'.wp_create_nonce('custom-css').'\" \/>';\r\n    echo '<textarea name=\"custom_css\" id=\"custom_css\" rows=\"5\" cols=\"30\" style=\"width:100%;\">'.get_post_meta($post->ID,'_custom_css',true).'<\/textarea>';\r\n}\r\nfunction save_custom_css($post_id) {\r\n    if (!wp_verify_nonce($_POST['custom_css_noncename'], 'custom-css')) return $post_id;\r\n    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;\r\n    $custom_css = $_POST['custom_css'];\r\n    update_post_meta($post_id, '_custom_css', $custom_css);\r\n}\r\nfunction insert_custom_css() {\r\n    if (is_page() || is_single()) {\r\n        if (have_posts()) : while (have_posts()) : the_post();\r\n            echo '<style type=\"text\/css\">'.get_post_meta(get_the_ID(), '_custom_css', true).'<\/style>';\r\n        endwhile; endif;\r\n        rewind_posts();\r\n    }\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u3067\u30da\u30fc\u30b8\u306b\u500b\u5225CSS\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002 \u30e1\u30a4\u30f3\u30c6\u30fc\u30de\u306eCSS\u3092\u635c\u67fb\u3057\u3066\u307b\u3057\u304f\u306a\u3044\u5834\u5408\u3084\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3054\u3068\u306b\u500b\u5225\u306bCSS\u3092\u5f53\u3066\u305f\u3044\u3068\u3044\u3063\u305f\u5834\u5408\u306b\u4fbf\u5229\u3067\u3059\u3002 add_action(&#8216;admin_menu&#8217;, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"","_original_post":"","footnotes":""},"categories":[1],"tags":[],"publishpress_future_action":{"enabled":false,"date":"2026-05-06 02:41:42","action":"change-status","newStatus":"draft","terms":[],"taxonomy":"category"},"_links":{"self":[{"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/posts\/1692"}],"collection":[{"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/comments?post=1692"}],"version-history":[{"count":0,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/posts\/1692\/revisions"}],"wp:attachment":[{"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/media?parent=1692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/categories?post=1692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/tags?post=1692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}