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

2015-03-31 1,781 1

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

<?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毫米 感觉不错 继续努力!

相关文章

MySQL 设置优化记录
来自 WPJAM 的修改,给图片文件名增加时间戳
wordpress 博客使用 CloudFlare 的页面规则缓存设置教程
Better Search Replace – 简单强大易用的数据库替换工具
WordPress获取文章所有图片和图片数量
删除 WooCommerce 产品页中的简介 – Remove Woocommerce Product Short Description

评论(1)

发布评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据