创建一个名为page-home.php的新页面模板文件 最好的方法是将index.php中的代码复制并粘贴到新页面中...... 在此页面内创建一个新的模板调用..
1 2 3 4 5 |
<?php /** Template Name: home */ ?> |
在这个页面里粘贴你的index.php代码..
1 2 3 4 5 6 7 8 |
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <?php the_content('<p>Read the rest of this page »</p>'); ?> <?php wp_link_pages(array('before' => '<p>Pages: ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> </div> <?php endwhile; endif; ?> |
这将像往常一样显示您的主页,然后您必须创建一个新的wordpress数据库调用,以显示您想要的所有类别的最新帖子或显示所有类别的所有帖子。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php //The Query query_posts('posts_per_page=5&cat=YOUR_CATEGORY_HERE'); //The Loop if ( have_posts() ) : while ( have_posts() ) : the_post(); .. endwhile; else: .. endif; //Reset Query wp_reset_query(); ?> |
这将循环显示帖子并显示您的最新帖子.. 通过wordpress查询帖子codex检查
哈哈哈