Wordpress教程:十三、文章页模版显示和调用内容
single.php //文章页模版(程序约定名称,这个文件会自动被识别)
single.php
<? get_header(); ?> <div class="c"> <div id="left-box"> <div id="post-box"> <? the_post(); //获取当前id的文章,存入全局变量,然后通过下面函数调用 ?> <div class="post-item"> //文章链接地址 //文章标题 <div class="post-title"><h2><a href="<? the_permalink(); ?>"><? the_title(); ?></a><h2></div> <div class="post-meta"> <? _e( 'category', 'huangcong' ); ?>:<? the_category(','); ?><span>|</span> <? _e( 'author', 'huangcong' ); ?>:<? the_author(); ?><span>|</span> <? echo __( 'time', 'huangcong' ); ?>:<? the_time( 'Y-m-d' ); ?> <? edit_post_link( __( 'Edit','huangcong' ), ' <span>|</span> ', '' ); ?> </div> <div class="post-content"><? the_content(); ?></div> </div> </div> </div> <? get_sidebar(); ?> </div> <? get_footer(); ?>
上一篇文章链接和下一篇文章链接的方法里可以输入内容
<div class="post-nav"> <? previous_post_link('上一篇:%link'); ?><br /> <? next_post_link('下一篇:%link'); ?> </div>
显示的效果是