{"id":4553,"date":"2025-12-31T08:00:00","date_gmt":"2025-12-30T23:00:00","guid":{"rendered":"https:\/\/web.syu-u.com\/blog\/?p=4553"},"modified":"2025-12-24T15:39:25","modified_gmt":"2025-12-24T06:39:25","slug":"%e3%83%af%e3%83%bc%e3%83%89%e3%83%97%e3%83%ac%e3%82%b9%e3%81%a7%e6%8a%95%e7%a8%bf%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%83%bc%e3%81%ae%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%82%92%e4%b8%80%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/web.syu-u.com\/blog\/?p=4553","title":{"rendered":"\u30ef\u30fc\u30c9\u30d7\u30ec\u30b9\u3067\u6295\u7a3f\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u30c7\u30b6\u30a4\u30f3\u3092\u4e00\u5b9a\u5468\u671f\u3067\u30eb\u30fc\u30d7\u3055\u305b\u308b"},"content":{"rendered":"\n<p class=\"leadtxt\">\u30ef\u30fc\u30c9\u30d7\u30ec\u30b9\u306e\u3088\u3046\u306aCMS\u3092\u5c0e\u5165\u3059\u308b\u5834\u5408\u3001\u6295\u7a3f\u30ab\u30c6\u30b4\u30ea\u30fc\u6bce\u306b\u30c7\u30b6\u30a4\u30f3\uff08\u8272\u3001\u5f62\u7b49\uff09\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u3044\u3066\u3082\u3001\u5229\u7528\u8005\u5074\u3067\u81ea\u7531\u306b\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u9805\u76ee\u6570\u3092\u5897\u3084\u3055\u308c\u305f\u5834\u5408\u306b\u3001\u521d\u671f\u8a2d\u5b9a\u3082\u306e\u306b\u306a\u308b\u4e8b\u3082\u591a\u304f\u3001\u7d50\u679c\u3068\u3057\u3066\u8a2d\u5b9a\u3057\u305f\u30c7\u30b6\u30a4\u30f3\u304c\u4f7f\u7528\u3055\u308c\u306a\u3044\u3053\u3068\u304c\u591a\u3044\u305f\u3081\u3001\u9805\u76ee\u6570\u3092\u5897\u3084\u3057\u3066\u3082\u3001\u8a2d\u5b9a\u3057\u305f\u30c7\u30b6\u30a4\u30f3\u3092\u30eb\u30fc\u30d7\u3055\u305b\u3066\u9069\u5fdc\u3055\u305b\u308b\u65b9\u6cd5\u3092\u30e1\u30e2\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading post_hedding_code\">CSS<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>.category01 {\n\tbackground: #f00;\n\tcolor: #fff;\n}\n.category02 {\n\tbackground: #00f;\n\tcolor: #fff;\n}\n.category03 {\n\tbackground: #ff0;\n}<\/code><\/pre>\n\n\n\n<p>CSS\u5074\u3067\u30eb\u30fc\u30d7\u3055\u305b\u305f\u3044\u30c7\u30b6\u30a4\u30f3\u3092\u8a2d\u5b9a\u3002<br>\u53c2\u8003\u4f8b\u306f3\u30d1\u30bf\u30fc\u30f3\u3092\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading post_hedding_code\">PHP\uff08index.php\u7b49\uff09<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n&lt;li>\n&lt;span>&lt;?php the_time('Y.m.j') ?>&lt;\/span>\n&lt;?php\n$categories = get_the_category();\n$raw_class = '';\n$loop_class = '';\n\nif($categories){\n\t$categories = $categories&#91;0];\n\t$raw_class = $categories->slug;\n\tif(preg_match('\/^category(\\d+)$\/', $raw_class, $matches)){\n\t\t$number = (int) $matches&#91;1];\n\t\t$mod = (($number - 1) % 3) + 1;\n\t\t$loop_class = 'category'.str_pad($mod, 2, '0', STR_PAD_LEFT);\n\t}\n\techo '&lt;span class=\"'.esc_attr($raw_class).' '.esc_attr($loop_class).'\">'.esc_html($categories->cat_name).'&lt;\/span>';\n}\n?>\n&lt;a href=\"&lt;?php the_permalink() ?>\">&lt;?php the_title(); ?>&lt;\/a>\n&lt;\/li>\n&lt;?php endwhile; else: ?>\n&lt;?php endif; ?><\/code><\/pre>\n\n\n\n<p>\u524d\u63d0\u6761\u4ef6\u3068\u3057\u3066\u3001\u30eb\u30fc\u30eb\u3092\u8a2d\u3051\u306a\u3044\u3068\u30eb\u30fc\u30d7\u51e6\u7406\u304c\u884c\u3048\u306a\u3044\u305f\u3081\u3001\u4eca\u56de\u306f\u30b9\u30e9\u30b0\u540d(slug)\u3092\u300ccategory\u25cb\u25cb\uff08\u25cb\u25cb\u306f\u6570\u5b57\uff09\u300d\u306e\u5f62\u5f0f\u306b\u56fa\u5b9a\u3002<br>\u53d6\u5f97\u3057\u305f\u30b9\u30e9\u30b0\u540d\u304b\u3089\u300cpreg_match\u300d\u95a2\u6570\u3067\u6570\u5b57\u306e\u307f\u3092\u53d6\u308a\u51fa\u3057\u3001\u8a2d\u5b9a\u3057\u305f\u30c7\u30b6\u30a4\u30f3\u6570\u3067\u9664\u7b97\u3059\u308b\u3053\u3068\u3067\u30eb\u30fc\u30d7\u3057\u305f\u5024\uff08$loop_class \uff09\u3092HTML\u30bf\u30b0\u306b\u8ffd\u52a0\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30b6\u30a4\u30f3\u306e\u30eb\u30fc\u30d7\u3092\u5b9f\u73fe\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u3001\u4eca\u56de\u306f\u30b9\u30e9\u30b0\u540d\u3092\u4f7f\u7528\u3057\u3066\u5b9f\u88c5\u3057\u3066\u3044\u308b\u307e\u3059\u304c\u300c\u8aac\u660e\uff08$categories->description\uff09\u9805\u76ee\u300d\u306b\u5165\u529b\u3057\u3066\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5c1a\u3001\u30eb\u30fc\u30d7\u51e6\u7406\u81ea\u4f53\u306f\u30ab\u30c6\u30b4\u30ea\u30fcID\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3082\u5b9f\u88c5\u306f\u53ef\u80fd\u3067\u3059\u304c\u3001\u30ab\u30c6\u30b4\u30ea\u30fcID\u306f\u4ed6\u306e\u9805\u76ee\u3068\u5171\u6709\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u7dba\u9e97\u306b\u9023\u756a\u306b\u306a\u3089\u306a\u3044\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30ef\u30fc\u30c9\u30d7\u30ec\u30b9\u306e\u3088\u3046\u306aCMS\u3092\u5c0e\u5165\u3059\u308b\u5834\u5408\u3001\u6295\u7a3f\u30ab\u30c6\u30b4\u30ea\u30fc\u6bce\u306b\u30c7\u30b6\u30a4\u30f3\uff08\u8272\u3001\u5f62\u7b49\uff09\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u3044\u3066\u3082\u3001\u5229\u7528\u8005\u5074\u3067\u81ea\u7531\u306b\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u9805\u76ee\u6570\u3092\u5897\u3084\u3055\u308c\u305f\u5834\u5408\u306b\u3001\u521d\u671f\u8a2d\u5b9a\u3082\u306e\u306b\u306a\u308b\u4e8b\u3082\u591a\u304f\u3001\u7d50\u679c\u3068\u3057\u3066\u8a2d\u5b9a\u3057\u305f\u30c7\u30b6\u30a4\u30f3\u304c\u4f7f\u7528\u3055\u308c\u306a\u3044\u3053\u3068\u304c\u591a\u3044\u305f\u3081\u3001\u9805\u76ee\u6570\u3092\u5897\u3084\u3057\u3066\u3082\u3001\u8a2d\u5b9a\u3057\u305f\u30c7\u30b6\u30a4\u30f3\u3092\u30eb\u30fc\u30d7\u3055\u305b\u3066\u9069\u5fdc\u3055\u305b\u308b\u65b9\u6cd5\u3092\u30e1\u30e2\u3002<\/p>\n","protected":false},"author":1,"featured_media":886,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,1],"tags":[],"class_list":["post-4553","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","category-homepage"],"_links":{"self":[{"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4553"}],"version-history":[{"count":4,"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4553\/revisions"}],"predecessor-version":[{"id":4570,"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4553\/revisions\/4570"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/886"}],"wp:attachment":[{"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.syu-u.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}