我的Wordpress网站没有使用single.php来显示网站上的帖子。每次我打开一个帖子时, 都会在index.php中打开它。
我的single.php看起来像这样
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<? echo the_content(); ?>
<? endwhile;
endif; ?>
<? get_footer();
?>
我怎样才能解决这个问题?
#1
单击单一帖子链接后, 无论呈现single-CUSTOM-TYPE.php还是single.php, 我都遇到了相同的问题….仅使用index.php而不是正确的文件…
帮助我的是, 在”设置”->”永久链接”中简单地更改回标准永久链接, 然后又恢复为”帖子名称”(Beitragsname)…。
…也许对别人也有帮助… greetz
#2
如果没有正确设置LOOP, 则会发生这种情况, 请确保index.php和single.php包含LOOP。
循环通常看起来像这样, 但是会更改为设置要求。
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
WordPress Codex网站非常棒, 可以回答大多数问题, 请访问http://codex.wordpress.org/The_Loop
此外, 如果你在堆栈姐妹网站Wordpress Stackexchange上发帖, 那么诸如此类的问题和讨论会更理想。我希望这个问题将被删除或移至https://wordpress.stackexchange.com/。
#3
你应该检查loop.php或loop-single.php是否从这些文件路由, 这是否是从数据库中提取数据的页面
来源:
https://www.srcmini02.com/67763.html