{"id":166619,"date":"2013-09-11T11:05:33","date_gmt":"2013-09-11T02:05:33","guid":{"rendered":"https:\/\/ja.wordpress.org\/support\/2013\/09\/11\/lightbox-gallery-plugin%e3%81%a8%e6%a8%99%e6%ba%96%e3%82%ae%e3%83%a3%e3%83%a9%e3%83%aa%e3%83%bc%e3%81%ae%e5%b9%b2%e6%b8%89%ef%bc%9f\/"},"modified":"2013-09-11T11:05:33","modified_gmt":"2013-09-11T02:05:33","slug":"lightbox-gallery-plugin%e3%81%a8%e6%a8%99%e6%ba%96%e3%82%ae%e3%83%a3%e3%83%a9%e3%83%aa%e3%83%bc%e3%81%ae%e5%b9%b2%e6%b8%89%ef%bc%9f","status":"closed","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/lightbox-gallery-plugin%e3%81%a8%e6%a8%99%e6%ba%96%e3%82%ae%e3%83%a3%e3%83%a9%e3%83%aa%e3%83%bc%e3%81%ae%e5%b9%b2%e6%b8%89%ef%bc%9f\/","title":{"rendered":"lightbox gallery plugin\u3068\u6a19\u6e96\u30ae\u30e3\u30e9\u30ea\u30fc\u306e\u5e72\u6e09\uff1f"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001wordpress3.6\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/ja.forums.wordpress.org\/topic\/6031?replies=6\">\u3053\u3061\u3089\u306e\u8a18\u4e8b<\/a>\u3092\u53c2\u8003\u306b\u30ae\u30e3\u30e9\u30ea\u30fc\u30b5\u30e0\u30cd\u30a4\u30eb\u306e\u4e0b\u306b\u753b\u50cf\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u8868\u793a\u3055\u305b\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u5f8c\u3001lightbox gallery plugin\u30d0\u30fc\u30b8\u30e7\u30f3 0.7.4\u3092\u5c0e\u5165\u5f8c\u3001<br \/>\n\u518d\u3073\u30ae\u30e3\u30e9\u30ea\u30fc\u3092\u8868\u793a\u3059\u308b\u3068\u30b5\u30e0\u30cd\u30a4\u30eb\u306e\u4e0b\u306b\u753b\u50cf\u306e\u30bf\u30a4\u30c8\u30eb\u304c\u8868\u793a\u3055\u308c\u306a\u304f\u306a\u308a\u3001<br \/>\n\u30d5\u30a9\u30fc\u30e9\u30e0\u3084\u30b0\u30b0\u3063\u3066\u307f\u305f\u306e\u3067\u3059\u304c\u89e3\u6c7a\u7b56\u304c\u308f\u304b\u3089\u305a\u3001\u3069\u306a\u305f\u304b\u3054\u6559\u6388\u9858\u3048\u306a\u3044\u304b\u3068\u6295\u7a3f\u81f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u4ee5\u4e0b\u306efunctions.php\u3092\u3044\u3058\u308a\u307e\u3057\u305f\u3002\u30c6\u30fc\u30de\u306ftwenty twelve\u3067\u3059\u3002<\/p>\n<p>functins.php\u306e\u6700\u4e0b\u90e8\u306b\u3001<\/p>\n<pre><code>add_action( &#039;customize_preview_init&#039;, &#039;twentytwelve_customize_preview_js&#039; );\nadd_filter( &#039;post_gallery&#039;, &#039;my_gallery&#039;, 10, 2 );\nfunction my_gallery( $output, $attr ) {\n  \/\/$post = get_post(); \n\n        static $instance = 0;\n        $instance++; \n\n        if ( ! empty( $attr[&#039;ids&#039;] ) ) {\n                \/\/ &#039;ids&#039; is explicitly ordered, unless you specify otherwise.\n                if ( empty( $attr[&#039;orderby&#039;] ) )\n                        $attr[&#039;orderby&#039;] = &#039;post__in&#039;;\n                $attr[&#039;include&#039;] = $attr[&#039;ids&#039;];\n        } \n\n        \/\/ Allow plugins\/themes to override the default gallery template. \n\n        \/\/ We&#039;re trusting author input, so let&#039;s at least make sure it looks like a valid orderby statement\n        if ( isset( $attr[&#039;orderby&#039;] ) ) {\n                $attr[&#039;orderby&#039;] = sanitize_sql_orderby( $attr[&#039;orderby&#039;] );\n                if ( !$attr[&#039;orderby&#039;] )\n                        unset( $attr[&#039;orderby&#039;] );\n        } \n\n        extract(shortcode_atts(array(\n                &#039;order&#039;      =&gt; &#039;ASC&#039;,\n                &#039;orderby&#039;    =&gt; &#039;menu_order ID&#039;,\n                &#039;id&#039;         =&gt; $post ? $post-&gt;ID : 0,\n                &#039;itemtag&#039;    =&gt; &#039;dl&#039;,\n                &#039;icontag&#039;    =&gt; &#039;dt&#039;,\n                &#039;captiontag&#039; =&gt; &#039;dd&#039;,\n                &#039;columns&#039;    =&gt; 3,\n                &#039;size&#039;       =&gt; &#039;thumbnail&#039;,\n                &#039;include&#039;    =&gt; &#039;&#039;,\n                &#039;exclude&#039;    =&gt; &#039;&#039;\n        ), $attr, &#039;gallery&#039;)); \n\n        $attr[&#039;link&#039;] = &#039;file&#039;;\n\n        $id = intval($id);\n        if ( &#039;RAND&#039; == $order )\n                $orderby = &#039;none&#039;; \n\n        if ( !empty($include) ) {\n                $_attachments = get_posts( array(&#039;include&#039; =&gt; $include, &#039;post_status&#039; =&gt; &#039;inherit&#039;, &#039;post_type&#039; =&gt; &#039;attachment&#039;, &#039;post_mime_type&#039; =&gt; &#039;image&#039;, &#039;order&#039; =&gt; $order, &#039;orderby&#039; =&gt; $orderby) ); \n\n                $attachments = array();\n                foreach ( $_attachments as $key =&gt; $val ) {\n                        $attachments[$val-&gt;ID] = $_attachments[$key];\n                }\n        } elseif ( !empty($exclude) ) {\n                $attachments = get_children( array(&#039;post_parent&#039; =&gt; $id, &#039;exclude&#039; =&gt; $exclude, &#039;post_status&#039; =&gt; &#039;inherit&#039;, &#039;post_type&#039; =&gt; &#039;attachment&#039;, &#039;post_mime_type&#039; =&gt; &#039;image&#039;, &#039;order&#039; =&gt; $order, &#039;orderby&#039; =&gt; $orderby) );\n        } else {\n                $attachments = get_children( array(&#039;post_parent&#039; =&gt; $id, &#039;post_status&#039; =&gt; &#039;inherit&#039;, &#039;post_type&#039; =&gt; &#039;attachment&#039;, &#039;post_mime_type&#039; =&gt; &#039;image&#039;, &#039;order&#039; =&gt; $order, &#039;orderby&#039; =&gt; $orderby) );\n        } \n\n        if ( empty($attachments) )\n                return &#039;&#039;; \n\n        if ( is_feed() ) {\n                $output = &quot;\\n&quot;;\n                foreach ( $attachments as $att_id =&gt; $attachment )\n                        $output .= wp_get_attachment_link($att_id, $size, true) . &quot;\\n&quot;;\n                return $output;\n        } \n\n        $itemtag = tag_escape($itemtag);\n        $captiontag = tag_escape($captiontag);\n        $icontag = tag_escape($icontag);\n        $valid_tags = wp_kses_allowed_html( &#039;post&#039; );\n        if ( ! isset( $valid_tags[ $itemtag ] ) )\n                $itemtag = &#039;dl&#039;;\n        if ( ! isset( $valid_tags[ $captiontag ] ) )\n                $captiontag = &#039;dd&#039;;\n        if ( ! isset( $valid_tags[ $icontag ] ) )\n                $icontag = &#039;dt&#039;; \n\n        $columns = intval($columns);\n        $itemwidth = $columns &gt; 0 ? floor(100\/$columns) : 100;\n        $float = is_rtl() ? &#039;right&#039; : &#039;left&#039;; \n\n        $selector = &quot;gallery-{$instance}&quot;; \n\n        $gallery_style = $gallery_div = &#039;&#039;;\n        if ( apply_filters( &#039;use_default_gallery_style&#039;, true ) )\n                $gallery_style = &quot;\n                &lt;style type=&#039;text\/css&#039;&gt;\n                        #{$selector} {\n                                margin: auto;\n                        }\n                        #{$selector} .gallery-item {\n                                float: {$float};\n                                margin-top: 10px;\n                                text-align: center;\n                                width: {$itemwidth}%;\n                        }\n                        #{$selector} img {\n                                border: 2px solid #cfcfcf;\n                        }\n                        #{$selector} .gallery-caption {\n                                margin-left: 0;\n                        }\n                        \/* see gallery_shortcode() in wp-includes\/media.php *\/\n                &lt;\/style&gt;&quot;;\n        $size_class = sanitize_html_class( $size );\n        $gallery_div = &quot;&lt;div id=&#039;$selector&#039; class=&#039;gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}&#039;&gt;&quot;;\n        $output = apply_filters( &#039;gallery_style&#039;, $gallery_style . &quot;\\n\\t\\t&quot; . $gallery_div ); \n\n        $i = 0;\n        foreach ( $attachments as $id =&gt; $attachment ) {\n                if ( ! empty( $attr[&#039;link&#039;] ) &amp;&amp; &#039;file&#039; === $attr[&#039;link&#039;] )\n                        $image_output = wp_get_attachment_link( $id, $size, false, false );\n                elseif ( ! empty( $attr[&#039;link&#039;] ) &amp;&amp; &#039;none&#039; === $attr[&#039;link&#039;] )\n                        $image_output = wp_get_attachment_image( $id, $size, false );\n                else\n                        $image_output = wp_get_attachment_link( $id, $size, true, false ); \n\n                $image_meta  = wp_get_attachment_metadata( $id ); \n\n                $orientation = &#039;&#039;;\n                if ( isset( $image_meta[&#039;height&#039;], $image_meta[&#039;width&#039;] ) )\n                        $orientation = ( $image_meta[&#039;height&#039;] &gt; $image_meta[&#039;width&#039;] ) ? &#039;portrait&#039; : &#039;landscape&#039;; \n\n                $output .= &quot;&lt;{$itemtag} class=&#039;gallery-item&#039;&gt;&quot;;\n                $output .= &quot;\n                        &lt;{$icontag} class=&#039;gallery-icon {$orientation}&#039;&gt;\n                                $image_output\n                        &lt;\/{$icontag}&gt;&quot;;\n                if ( $captiontag &amp;&amp; trim($attachment-&gt;post_title) ) {\n                        $output .= &quot;\n                                &lt;{$captiontag} class=&#039;wp-caption-text gallery-caption&#039;&gt;\n                                &quot; . wptexturize($attachment-&gt;post_title) . &quot;\n                                &lt;\/{$captiontag}&gt;&quot;;\n                }\n                $output .= &quot;&lt;\/{$itemtag}&gt;&quot;;\n                if ( $columns &gt; 0 &amp;&amp; ++$i % $columns == 0 )\n                        $output .= &#039;&lt;br style=&quot;clear: both&quot; \/&gt;&#039;;\n        } \n\n        $output .= &quot;\n                        &lt;br style=&#039;clear: both;&#039; \/&gt;\n                &lt;\/div&gt;\\n&quot;; \n\n        return $output;\n}<\/code><\/pre>\n<p>\u3053\u3061\u3089\u304c\u8ffd\u8a18\u3055\u308c\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u305f\u306e\u306f[gallrey num=&#8221;\u4efb\u610f\u306e\u6570\u5b57&#8221;]\u6a5f\u80fd\u3067\u5927\u91cf\u306e\u753b\u50cf\u3092\u81ea\u52d5\u3067\u30da\u30fc\u30b8\u5206\u5272\u3059\u308b\u70ba\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u30d7\u30e9\u30b0\u30a4\u30f3\u3068functins.php\u306e\u5e72\u6e09\u306a\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>[gallrey num=&#8221;\u4efb\u610f\u306e\u6570\u5b57&#8221;]\u306e\u6a5f\u80fd\u3068\u30b5\u30e0\u30cd\u30a4\u30eb\u306e\u4e0b\u306b\u753b\u50cf\u306e\u30bf\u30a4\u30c8\u30eb\u304c\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u306e\u3067\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u308f\u305a\u307b\u304b\u306e\u65b9\u6cd5\u304c\u3042\u308c\u3070\u305d\u3061\u3089\u3067\u3082\u304b\u307e\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u53ea\u4eca\u3001\u975e\u5e38\u306b\u56f0\u3063\u3066\u304a\u308a\u307e\u3059\u3002\u3069\u306a\u305f\u304b\u3069\u3046\u304b\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"template":"","class_list":["post-166619","topic","type-topic","status-closed","hentry","topic-tag-14418","topic-tag--lightbox--functions-p","topic-tag-20978","topic-tag-functions-php","topic-tag-lightbox"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/166619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/166619\/revisions"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=166619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}