无法识别Tag.php

时间:2019-07-03 14:48:47

标签: php wordpress wordpress-theming

我正在尝试设置/post_tag/tag/页面的样式。由于某种原因,我的tag.php未被识别。它一直默认为我的index.php。我不知道我在做什么错。我已经在下面发布了我的测试代码。

我已经尝试过涉及tag-idtag-slug的各种文件名。

<?php
/**
 * The template for displaying Tag pages
 *
 * Used to display archive-type pages for posts in a tag.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 */
get_header(); ?>
helo
<?php get_footer();?>

当我转到site/post_tag/tag时希望看到上面的页面,但是我看到了我的索引。

1 个答案:

答案 0 :(得分:0)

我不经常使用标签,只是对本地安装进行了快速检查,对于我来说,可以通过以下方式访问tag.php

www.site.com/tag/tag-name

如果使用您建议的网址,则得到index.php,但实际上是404页面(我可以在页面标题中看到),我只是没有创建404.php。

相关问题