蹭网器价格

设置WordPress内置缩略图

时间: 2010-01-22 / 分类: wordpress技巧 / 浏览次数: 21 次 / 0个评论 发表评论

WordPress 2.9已经内置了缩略图的功能,但没有直接启用。如何启用缩略图的功能呢?方法很简单,就是在你所用的主题的functions.php文件中添加:

if ( function_exists( ‘add_theme_support’ ) ) {
add_theme_support( ‘post-thumbnails’ );
}

添加完这个以后,侧边栏已经出现了缩略图的选择了。如何调用文章的缩略图?

在主题的index.php或者archive.php中

找到
< ?php the_content(‘Read the rest of this entry »’); ? >
类似代码,在其上方添加代码
< ?php if ( has_post_thumbnail() ) : ? >
< ?php the_post_thumbnail( array( 125, 125 ), array( ‘class’ => ‘alignleft’ ) ); ? >
< ?php endif; ? >
其中,arry(125, 125)是说缩略图的大小,同样也可以根据后台的设置,指定为thumbnail、medium、large或者full。
至于array( ‘class’ => ‘alignleft’ ),指定的就是图片的class效果了。

转自http://dd54.net

无觅相关文章插件

其他人还看了



本文标签: wordpress, 主题下载, 免费php空间申请



给资源评分:
1 星2 星3 星4 星5 星 (暂无评价)
载入中…… ... 载入中…… ...
免费空间申请订阅

发表评论

您的昵称 *

您的邮箱 *

您的网站

蹭网卡报价_免费asp空间申请的地址_如何申请免费域名教程及攻略_免费域名空间申请的方法