WordPress主題開發內容相關編寫,內容分內容列表和內容詳情兩部分。
首先說下列表
文章標題
<h3 class="title"><a href="/<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
文章標簽
<?php the_tags('標簽:', ', ', ''); ?>
添加日期
<?php the_time('Y年n月j日') ?>
顯示評論數
<?php comments_popup_link('0 條評論', '1 條評論', '% 條評論', '', '評論已關閉'); ?>
添加編輯按鈕
<?php edit_post_link('編輯', ' ? ', ''); ?>
添加文章內容
<?php the_excerpt(); ?>
<?php the_content('閱讀全文...'); ?>
閱讀全文
<a href="/<?php the_permalink(); ?>" class="button right">閱讀全文</a>
文章循環
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
內容
<?php endwhile; ?>
<?php else : ?>
輸出找不到文章
<?php endif; ?>
分頁
<p class="clearfix"><?php previous_posts_link('<< 查看新文章', 0); ?> <span class="float right"><?php next_posts_link('查看舊文章 >>', 0); ?></span></p>
函數詳解
<?php the_permalink(); ?> 輸出文章的URL鏈接
<?php the_title(); ?> 輸出文章的標題
<?php the_tags('標簽:', ', ', ''); ?> 標簽
基本上,一個頁面的內容已經包括了,大家根據自己的需求自定義的Diy
接下來說下單頁
可以直接很使用如下
<!-- Column 1 /Content -->
<?php if (have_posts()) : the_post(); update_post_caches($posts); ?>
內容
<?php else : ?>
<div class="errorbox">
沒有文章!
</div>
<?php endif; ?>
<?php get_sidebar(); ?>





