繁体   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