这个page.PHP有很多东西跟single.PHP也都是相通的,或者基本都一样,这里我们对部分内容也不做太多的解析,直接上结果,如果有不懂的可以翻翻wordpress主题制作全过程(八):制作index.PHP。
<!-- Column 1 / Content -->
改成:
<!-- Column 1 / Content -->
<h2 class="grid_12 caption clearfix"><?PHP the_title(); ?></h2>
<h2 class="grid_12 caption clearfix"><?PHP the_title(); ?></h2>
<p>Lorem ipsum dolor sit amet,consectetur adipiscing elit. Mauris vel porta erat. Quisque sit amet risus at odio pellentesque sollicitudin. Proin suscipit molestie facilisis. Aenean vel massa magna. Proin nec lacinia augue. Mauris venenatis libero nec odio viverra consequat. In hac habitasse platea dictumst.</p>
改成:
<?PHP the_content(); ?>
3、添加评论框
将<!-- Contact Form --> 与 </form>之间的所有代码删除(包括</form>)
替换成:
<?PHP comments_template(); ?>
4、添加查询语句
搜索代码:<!-- Column 1 / Content -->
改成:
<!-- Column 1 / Content -->
<?PHP if (have_posts()) : the_post(); update_post_caches($posts); ?>
<?PHP if (have_posts()) : the_post(); update_post_caches($posts); ?>
查找:
</div>
<?PHP get_sidebar(); ?>
<?PHP get_sidebar(); ?>
改成:
</div>
<?PHP else : ?>
<div class="grid_8">
没有找到你想要的页面!
</div>
<?PHP endif; ?>
<?PHP get_sidebar(); ?>
<?PHP else : ?>
<div class="grid_8">
没有找到你想要的页面!
</div>
<?PHP endif; ?>
<?PHP get_sidebar(); ?>
我们的page.PHP就制作完毕了。另外还有两个页面,无边栏页面full_width.PHP,联系页contact.PHP,制作方法完全一样,这里就不再详述了,我已经直接写好了,下载即可。你可能会问,那这两个页面怎么用呢?我分别在这两个页面的前面写了两个注释: