该网站有一些启用了存档页面的自定义帖子类型 . 所以我得到以下URL结构
http://example.com/offices/ This is the archive page for office
http://example.com/office/san-fran This is the single page for office
http://example.com/office/new-york This is the single page for office
和
http://example.com/members/ This is the archive page for member
http://example.com/member/john-smith This is the single page for member
CPT的一切都很好用 .
但我正在尝试更改内置post_type“post”的基本路径 . 我首先将永久链接设置更新为
/blog/%year%/%monthnum%/%day%/%postname%/
这照顾
http://example.com/blog/2017/10/post
http://example.com/blog/2017/10/
http://example.com/blog/2017/
但
http://example.com/blog/
不起作用 . 经过一些谷歌搜索,我创建了一个名为“博客”的空白页面,并在设置 - >阅读中将其设置为我的“帖子页面” . 有点工作,但Wordpress似乎并不把它当作存档页面 .
在查看post_classes时,办公室会有这样的东西
class="archive post-type-archive post-type-archive-office logged-in tribe-no-js sidebar-primary app-data index-data archive-data archive-office-data"
和博客会是这样的
class="blog logged-in tribe-no-js app-data index-data home-data"
我考虑过为博客创建另一个CPT,但我更喜欢使用内置帖子 . 有没有办法为帖子创建真正的存档页面?
1 回答
如果您没有
archive.php
-template和/或您的CPT被键入为页面而不是帖子,则可能会导致此行为 .