使用index.php而不是archive.php的WordPress

通过阅读WP模板层次结构, 我的理解是, 当我在”设置”>”读取设置”中将页面设置为我的帖子页面时, WordPress应该使用archive.php。相反, 它使用index.php。

显然, 我可以将我的代码放在index.php中, 我的网站可以正常工作。但这似乎不是最佳实践, 而且我找不到最佳实践(或最佳实践)的任何文档。

为什么Wordpress在这种情况下不使用archive.php?

使用index.php作为我的帖子页面会产生意想不到的后果吗?

注意:我一直使用_s主题作为基础, 但是我遇到了同样的问题, 没有主题基础或父主题。


#1


你要使用home.php而不是archive.php, 因为它是博客文章索引页面(在WordPress设置->阅读中设置)。它也位于层次结构中从底部开始的第三个位置。


#2


最近2/3小时, 我处于类似情况, 并且通过在Wordpress仪表板中将”固定链接设置”更改为”帖子名称”为我解决了该问题。

来源:

https://www.srcmini02.com/64584.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37419.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?