查看完整版本: 如何在摘要中显示一个导读图呢?

jsuper 2008-9-17 13:47

如何在摘要中显示一个导读图呢?

[url=http://www.zhan2.com/]http://www.zhan2.com/[/url]
上面这个博客,每个新闻右边会有个导读图,文章里没有,请问这个是用什么插件实现的呢?谢谢

shamas 2008-9-17 13:50

加了个字段,然后调用显示

jsuper 2008-9-17 16:22

这个,不懂PHP

hedy 2008-9-17 16:46

在写日志的下边有一个自定义字段,加一个字段就行
例如Image字段
值为1.jpg
然后在模板里边要显示的地方添加上
例如
    <?php while (have_posts()) : the_post(); ?>
      <?php
// this grabs the image filename
$values = get_post_custom_values("Image");
// this checks to see if an image file exists
        if (isset($values[0])) {                                                
?>
      <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/images/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="" /></a>
      <?php } ?>
      <a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php
// this is where title of the article gets printed         
          the_title(); ?>&raquo;</a>
<?php the_excerpt(); ?>
      <?php endwhile; ?>

[[i] 本帖最后由 hedy 于 2008-9-17 16:48 编辑 [/i]]

scutdk 2008-9-19 23:09

收藏了
谢谢楼上分享

luring 2008-9-21 00:17

收藏!!!

zzf369 2008-9-22 13:57

谢谢,收下了

打篮球的手 2008-9-22 14:22

顶一下4楼的

jsuper 2008-10-2 11:10

谢谢,非常感谢。

hnchenbo 2008-10-7 11:29

代码加到哪啊?

shenrui01 2008-10-12 10:20

十分感谢,正需要!

口袋 2008-10-12 23:02

好文.留印,收藏
页: [1]
查看完整版本: 如何在摘要中显示一个导读图呢?