{"id":5580,"date":"2013-07-22T14:00:31","date_gmt":"2013-07-22T05:00:31","guid":{"rendered":"http:\/\/blog.pianoman-net.com\/?p=5580"},"modified":"2013-07-22T14:31:58","modified_gmt":"2013-07-22T05:31:58","slug":"advanced-custom-fields%e3%81%a7%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%83%89%e3%81%ae%e5%80%a4%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e5%87%ba%e5%8a%9b%e3%81%99%e3%82%8b5%e3%81%a4%e3%81%ae","status":"publish","type":"post","link":"https:\/\/blog.pianoman-net.com\/?p=5580","title":{"rendered":"Advanced Custom Fields\u3067\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024\u3092\u53d6\u5f97\u3057\u3066\u51fa\u529b\u3059\u308b5\u3064\u306e\u30d1\u30bf\u30fc\u30f3\u3002"},"content":{"rendered":"<p><img loading=\"lazy\" src=\"https:\/\/blog.pianoman-net.com\/wp-content\/uploads\/2011\/12\/eyecatch_wp.png\" alt=\"WordPress\" width=\"160\" height=\"120\" class=\"alignright size-full wp-image-2540\" \/><br \/>\n<a href=\"https:\/\/wordpress.org\/plugins\/advanced-custom-fields\/\" title=\"Advanced Custom Fields\" target=\"_blank\" rel=\"noopener\">Advanced Custom Fields<\/a>\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u305f\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u64cd\u4f5c\u306e\u7df4\u7fd2\u30e1\u30e2\u3002\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024\u3092\u53d6\u5f97\u3057\u3066\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5\u3092\u7e8f\u3081\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n<br clear=\"all\" \/><br \/>\n<!--more--><br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n<strong>\uff10\uff0e\u57fa\u672c\u7684\u306a\u65b9\u6cd5<\/strong><\/p>\n<p>\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024\u3092\u53d6\u5f97\u3057\u3066\u8868\u793a\u3059\u308b\u306b\u306f\u3001\u300cthe_field()\u300d\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nthe_field('field_name_01');\r\n<\/pre>\n<p>&nbsp;<br \/>\n\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024\u3092\u53d6\u5f97\u3057\u3066\u5909\u6570\u306b\u4ee3\u5165\u3057\u3066\u4f7f\u3046\u5834\u5408\u306a\u3069\u306f\u3001\u300cget_field()\u300d\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$hoge = get_field('field_name_01');\r\n<\/pre>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n<strong>\uff11\uff0e\u30d5\u30a3\u30fc\u30eb\u30c9\u30bf\u30a4\u30d7\uff1a\u30c6\u30ad\u30b9\u30c8<\/strong><\/p>\n<p>\u53d6\u5f97\u3057\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\uff1afield_name_01\uff09\u306b\u4f55\u304b\u5165\u529b\u3055\u308c\u3066\u3044\u305f\u3089\u3001\u5024\u3092\u8868\u793a\u3059\u308b\u5834\u5408\u306e\u4f8b\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$text = get_field('field_name_01');\r\nif ( $text )  {\r\n\techo $text;\r\n}\r\n<\/pre>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n<strong>\uff12\uff0e\u30d5\u30a3\u30fc\u30eb\u30c9\u30bf\u30a4\u30d7\uff1a\u30c6\u30ad\u30b9\u30c8\u30a8\u30ea\u30a2<\/strong><\/p>\n<p>\u6539\u884c\u3067\u533a\u5207\u3089\u308c\u305f\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\uff1afield_name_01\uff09\u306e\u5024\u3092\u53d6\u5f97\u3057\u3001\u30ea\u30b9\u30c8\u5f62\u5f0f\u306b\u6210\u5f62\u3057\u3066\u8868\u793a\u3059\u308b\u5834\u5408\u306e\u4f8b\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$fieldData = explode(&quot;\\n&quot;,get_post_meta($post-&gt;ID,'field_name_01',true) );\r\n$i = 0;\r\necho &quot;&lt;ul&gt;&quot;;\r\nforeach ($fieldData as $value){\r\n\tif ( $value ){\r\n\t\techo '&lt;li&gt;' . $value . '&lt;\/li&gt;';\r\n\t}\r\n\t$i++;\r\necho &quot;&lt;\/ul&gt;&quot;;\r\n}\r\n<\/pre>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n<strong>\uff13\uff0e\u30d5\u30a3\u30fc\u30eb\u30c9\u30bf\u30a4\u30d7\uff1a\u6570\u5024<\/strong><br \/>\n\u53d6\u5f97\u3057\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\uff1afield_name_01\uff09\u306e\u5024\u3092\u3001\u5343\u4f4d\u6bce\u306e\u533a\u5207\u308a\u53ca\u3073\u5c0f\u6570\u70b9\u4ee5\u4e0b\u7b2c\u4e00\u4f4d\u307e\u3067\u8868\u793a\u3055\u305b\u308b\u5834\u5408\u306e\u4f8b\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\necho number_format( get_post_meta($post-&gt;ID,'field_name_01',true) , 1 );\r\n<\/pre>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n<strong>\uff14\uff0e\u30d5\u30a3\u30fc\u30eb\u30c9\u30bf\u30a4\u30d7\uff1aWysiwyg \u30a8\u30c7\u30a3\u30bf<\/strong><\/p>\n<p>\u53d6\u5f97\u3057\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\uff1afield_name_01\uff09\u306e\u5024\u306b\u753b\u50cf\u306b\u30ea\u30f3\u30af\u3092\u8cbc\u3063\u3066\u3044\u308b\u7b87\u6240\u304c\u5b58\u5728\u3057\u305f\u3089\u3001a\u30bf\u30b0\u306b\u300crel=&#8221;lightbox&#8221;\u300d\u3092\u4ed8\u52a0\u3059\u308b\u5834\u5408\u306e\u4f8b\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$pattern = &quot;\/&lt;a(.*?)href=('|\\&quot;)(.*?).(bmp|gif|jpeg|jpg|png)('|\\&quot;)(.*?)&gt;\/i&quot;;\r\n$replacement = '&lt;a$1href=$2$3.$4$5 rel=&quot;lightbox&quot;$6&gt;';\r\n\r\n$dataText = get_field(&quot;field_name_01&quot;, $post-&gt;ID);\r\n$dataText = preg_replace ( $pattern , $replacement , $dataText);\r\n\r\necho $dataText;\r\n<\/pre>\n<blockquote><p>\n\u3010\u53c2\u8003\u30b5\u30a4\u30c8\u3011<br \/>\n<a href=\"https:\/\/www.afrojapan.com\/blog\/blog-and-afronamihei\/kiji351\" title=\"AfroNamiHei\u306e\u7bb1 - WordPress\u3067lightbox 2.0\u3092\u4f7f\u3046\" target=\"_blank\" rel=\"noopener\">\u300bAfroNamiHei\u306e\u7bb1 &#8211; WordPress\u3067lightbox 2.0\u3092\u4f7f\u3046<\/a>\n<\/p><\/blockquote>\n<p><strong><span style=\"color:red\">\u203b<\/span><\/strong> \u30b5\u30a4\u30c8\u3067lightbox\u3092\u4f7f\u3063\u3066\u3044\u3066\u3001Wysiwyg \u30a8\u30c7\u30a3\u30bf\u3092\u6307\u5b9a\u3057\u305f\u9805\u76ee\u3067\u300c\u30e1\u30c7\u30a3\u30a2\u3092\u8ffd\u52a0\u300d\u3067\u753b\u50cf\u3092\u8cbc\u308a\u4ed8\u3051\u305f\u5834\u5408\u3001\u300crel=&#8221;lightbox&#8221;\u300d\u304c\u4ed8\u304b\u305a\u306blightbox\u304c\u52d5\u4f5c\u3057\u306a\u3044\u306e\u3067\u5024\u3092\u53d6\u5f97\u3057\u3066\u8868\u793a\u3059\u308b\u969b\u306b\u4ed8\u52a0\u3057\u3066\u3042\u3052\u308b\u5fc5\u8981\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n<strong>\uff15\uff0e\u30d5\u30a3\u30fc\u30eb\u30c9\u30bf\u30a4\u30d7\uff1a\u753b\u50cf<\/strong><\/p>\n<p>\u53d6\u5f97\u3057\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\uff1afield_name_01\uff09\u306e\u753b\u50cf\u3092large\u30b5\u30a4\u30ba\u3067\u8868\u793a\u3059\u308b\u5834\u5408\u306e\u4f8b\u3002\uff08lightbox\u3092\u4f7f\u3046\u524d\u63d0\u3067\u3001a\u30bf\u30b0\u306b\u306f\u300crel=&#8221;lightbox&#8221;\u300d\u3092\u3064\u3051\u3066\u3044\u307e\u3059\u3002\uff09<\/p>\n<p><strong><span style=\"color:red\">\u203b<\/span><\/strong> \u30d5\u30a3\u30fc\u30eb\u30c9\u540d\u300cfield_name_01\u300d\u3092\u5b9a\u7fa9\u3059\u308b\u6642\u306b\u3001\u300c\u8fd4\u308a\u5024\u300d\u306f\u300c\u753b\u50cf ID\u300d\u3092\u6307\u5b9a\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\t$attachment_id = get_field('field_name_01');\r\n\t$size = &quot;large&quot;; \/\/ (thumbnail, medium, large, full or custom size)\r\n\t$image = wp_get_attachment_image_src( $attachment_id, $size );\r\n\t$attachment = get_post( get_field('field_name_01') );\r\n\t$alt = get_post_meta($attachment-&gt;ID, '_wp_attachment_image_alt', true);\r\n\t$image_title = $attachment-&gt;post_title;\r\n?&gt;\r\n\r\n&lt;a href=&quot;&lt;?php echo wp_get_attachment_url( get_field( 'field_name_01',$post-&gt;ID) ); ?&gt;&quot; rel=&quot;lightbox&quot;&gt;&lt;img src=&quot;&lt;?php echo $image[0]; ?&gt;&quot; width=&quot;&lt;?php echo $image[1]; ?&gt;&quot; height=&quot;&lt;?php echo $image[2]; ?&gt;&quot; alt=&quot;&lt;?php echo $alt; ?&gt;&quot; title=&quot;&lt;?php echo $image_title; ?&gt;&quot; \/&gt;&lt;\/a&gt;\r\n<\/pre>\n<blockquote><p>\n\u3010\u53c2\u8003\u30b5\u30a4\u30c8\u3011<br \/>\n<a href=\"https:\/\/webcre-archive.com\/2012\/09\/11\/advanced-custom-fields-image\/\" title=\"Webcre Archive - Advanced Custom Fields \u3067\u753b\u50cf\u3092\u633f\u5165\u3057\u3066\u307f\u308b\" target=\"_blank\" rel=\"noopener\">\u300bWebcre Archive &#8211; Advanced Custom Fields \u3067\u753b\u50cf\u3092\u633f\u5165\u3057\u3066\u307f\u308b<\/a><\/p><\/blockquote>\n<p>\u6700\u5f8c\u306e\u753b\u50cf\u3092\u633f\u5165\u3059\u308b\u90e8\u5206\u304c\u4e00\u756a\u60a9\u307f\u307e\u3057\u305f\u304c\u3001\u305d\u3053\u306fWordPress\u3002\u30b0\u30b0\u3063\u305f\u3089\u30c9\u30f3\u3074\u3057\u3083\u306a\u8a18\u4e8b\u304c\u3042\u308a\u3001\u7121\u4e8b\u89e3\u6c7a\u3067\u304d\u307e\u3057\u305f\u3002\u3042\u3001\u3084\u307e\u308a\u3085\u3046\u3055\u3093\u3001\u3054\u7121\u6c99\u6c70\u3057\u3066\u307e\u3059\uff06\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<div style=\"text-align:center;\">\n<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"https:\/\/fpdownload.macromedia.com\/get\/flashplayer\/current\/swflash.cab\" id=\"Player_61a6b253-d69f-47ee-b727-d65c88211f69\"  WIDTH=\"500px\" HEIGHT=\"175px\"> <PARAM NAME=\"movie\" VALUE=\"https:\/\/ws.amazon.co.jp\/widgets\/q?rt=tf_cw&#038;ServiceVersion=20070822&#038;MarketPlace=JP&#038;ID=V20070822%2FJP%2Fmelodiesofpia-22%2F8010%2F61a6b253-d69f-47ee-b727-d65c88211f69&#038;Operation=GetDisplayTemplate\"><PARAM NAME=\"quality\" VALUE=\"high\"><PARAM NAME=\"bgcolor\" VALUE=\"#FFFFFF\"><PARAM NAME=\"allowscriptaccess\" VALUE=\"always\"><embed src=\"https:\/\/ws.amazon.co.jp\/widgets\/q?rt=tf_cw&#038;ServiceVersion=20070822&#038;MarketPlace=JP&#038;ID=V20070822%2FJP%2Fmelodiesofpia-22%2F8010%2F61a6b253-d69f-47ee-b727-d65c88211f69&#038;Operation=GetDisplayTemplate\" id=\"Player_61a6b253-d69f-47ee-b727-d65c88211f69\" quality=\"high\" bgcolor=\"#ffffff\" name=\"Player_61a6b253-d69f-47ee-b727-d65c88211f69\" allowscriptaccess=\"always\"  type=\"application\/x-shockwave-flash\" align=\"middle\" height=\"175px\" width=\"500px\"><\/embed><\/OBJECT> <NOSCRIPT><A HREF=\"https:\/\/ws.amazon.co.jp\/widgets\/q?rt=tf_cw&#038;ServiceVersion=20070822&#038;MarketPlace=JP&#038;ID=V20070822%2FJP%2Fmelodiesofpia-22%2F8010%2F61a6b253-d69f-47ee-b727-d65c88211f69&#038;Operation=NoScript\">Amazon.co.jp \u30a6\u30a3\u30b8\u30a7\u30c3\u30c8<\/A><\/NOSCRIPT>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Advanced Custom Fields\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u305f\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u64cd\u4f5c\u306e\u7df4\u7fd2\u30e1\u30e2\u3002\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024\u3092\u53d6\u5f97\u3057\u3066\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5\u3092\u7e8f\u3081\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":2540,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[29,5],"tags":[569,38,570],"_links":{"self":[{"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=\/wp\/v2\/posts\/5580"}],"collection":[{"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5580"}],"version-history":[{"count":26,"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=\/wp\/v2\/posts\/5580\/revisions"}],"predecessor-version":[{"id":5610,"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=\/wp\/v2\/posts\/5580\/revisions\/5610"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=\/wp\/v2\/media\/2540"}],"wp:attachment":[{"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pianoman-net.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}