簡體   English   中英

WordPress類別重定向到index.php

[英]Wordpress categories redirecting to index.php

大家好,大家好!

我從頭開始開發了一個wordpress主題,到目前為止一切似乎進展順利。 但是現在我有一個小問題。 當我單擊默認wp側欄中的“帖子”類別之一時,盡管該鏈接引用了該類別的確切名稱,但我仍被重定向到index.php。

如何解決該問題,因此,當我單擊某個類別時,會收到該類別中的帖子?

我的猜測是我的archive.php頁面或類似的東西一定有問題。 我不熟悉所有這些,所以請原諒我的問題。

預先感謝!

因此,由於anstrangel0ver對category.php文件的引用,我設法解決了問題,這使我進入了http://bit.ly/1uMC6UC ,但是那里的代碼有一個我剛剛修復的小錯誤,所以這里是:

我必須將其放在category.php文件中,以便我解決問題:

<?php
/**
* A Simple Category Template
*/

get_header(); ?>

<section id="primary" class="site-content">
    <div id="content" role="main">
        <?php // Check if there are any posts to display ?>
        <?php if ( have_posts() ) : ?>
            <?php while ( have_posts() ) : the_post(); ?>

            <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
            <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>

            <div class="entry">
                <?php the_excerpt(); ?>
                <p class="postmetadata"><?php comments_popup_link( 'No comments yet', '1 comment', '% comments', 'comments-link', 'Comments closed'); ?></p>
            </div>

        <?php endwhile; ?>
    <?php else: ?>
        <p>Sorry, no posts matched your criteria.</p>
    <?php endif; ?>
</div>

注意:這只是一個通用文件結構,因此必須根據您的需要對其進行修改。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM