在写日志的下边有一个自定义字段,加一个字段就行
例如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(); ?>»</a>
<?php the_excerpt(); ?>
<?php endwhile; ?>
[ 本帖最后由 hedy 于 2008-9-17 16:48 编辑 ]