- 使用Wordpress相册
Wordpress2.5加入了全新的相册功能,我们以前也介绍过如何在日志和页面中调用它。但这个功能相当单薄,让我们来丰富一下:
打开single.php并另存为image.php,在the_content函数之前插入以下代码:
- <p class="attachment">
- <a href="<?php echo wp_get_attachment_url($post->ID); ?>">< ?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></a>
- </p>
- <div class="caption">
- < ?php if ( !empty($post->post_excerpt) ) the_excerpt(); // this is the "caption" ?>
- </div>
在the_content函数之后插入以下代码:
- <div class="imgnav">
- <div class="imgleft">< ?php previous_image_link() ?></div>
- <div class="imgright">< ?php next_image_link() ?></div>
- </div>
- <br clear="all" />
- ?>
css样式:
[更多查看原文]
挖友还挖到了什么 · · · · · ·