wordpress内容页获取所有图片附件,并且瀑布流方式调用

囧客圈作为一个欢乐又变态的网站,
就要有欢乐又变态的展示方式,
不仅列表页用瀑布流,内容页也要上瀑布流!
那么下面这段小代码就是为了在内容也获取所有图片附件的调用方式:

<?php
				    foreach ( $attachments as $attachment ) {
					  $size = wp_get_attachment_image_src($attachment->ID);
				      echo '<li> ';
				      //the_attachment_link( $attachment->ID, false, false, true );
				      echo '<a href="'.get_permalink( $attachment->ID ).'#oye" class="photoview pic_tip" title="点击查看原图">';
				      //echo '<a href="'.get_attachment_link( $attachment->ID ).'" title="点击查看原图" >';
				      echo '<img class="scrollLoading current" data-url="'.wp_get_attachment_thumb_url( $attachment->ID ).'" src="http://jokeoo.com/wp-content/themes/zlxppp_test/img/pixel.gif" style="background:url(http://jokeoo.com/wp-content/themes/zlxppp_test/img/loading.gif) no-repeat center;" height="'.$size[2].'">';
				      echo '</a>';
				      echo '</span></li>';
				    }
				  endwhile; endif;
				 ?>

哥在wordpress的大道上又前进了1毫米 感觉不错 继续努力!

小 虾

哦也,我是小虾

You may also like...