我有category.php文件,它在我們打開分類鏈接時工作正常。 但在類別.php中,當我點擊「下一頁」鏈接時,它會打開index.php而不是category.php的下一頁。 這裏是一個小的我category.php代碼:Category.php =>下一頁打開Index.php
<?php
if (is_category()) {
$cat = get_query_var('cat');
$yourcat = get_category ($cat);
$CAT=$yourcat->slug;
} ?>
<?php query_posts("category_name=$CAT&showposts=1&order=ASC"); ?>
<?php while (have_posts()) : the_post(); ?>
.
.
.
<?php endwhile;?>
<?php posts_nav_link(); ?>
而且index.php的代碼:
<?php query_posts('category_name=new_publish'); ?> <?php while (have_posts()) : the_post(); ?>
.
.
.
<?php endwhile;?>
你不需要在category.php – Banago
確定一個自定義的循環。剛刪除第2行至第5行,category_name = $ CAT。沒有差別。 –