简体   繁体   English

WordPress的-重写帖子永久链接

[英]wordpress - Rewrite post permalink

I've a custom post type that it can view on mywebsite.com/custom_post_type/ (with archive.php), but I don't understand how change permalink of "post" (default type - articles). 我有一个自定义帖子类型,可以在mywebsite.com/custom_post_type/(使用archive.php)上查看,但我不了解如何更改“帖子”的永久链接(默认类型-文章)。 This is what I need: I want to read all "post" with this url: mywebsite.com/news/. 这就是我需要的:我想阅读所有带有以下URL的“发布”:mywebsite.com/news/。 "News" would the slug for "post" type. “新闻”将成为“发布”类型的子弹。

I think it's necessary to rewrite the permalink, but I didn't found anything on google. 我认为有必要重写永久链接,但我在Google上找不到任何内容。

Can you help me? 你能帮助我吗? Thanks 谢谢

I'm not 100% sure I understand your questions but I think you are trying to do is view all 'Posts' under mywebsite.com/news/ - In that case simply create a page called News (with the slug/permalink as news) and then in Settings > Reading - set the Front page to 'A static page', with the front page selecting your 'Home' page and the Posts page set as 'News' (the page you just made). 我不是100%肯定我理解您的问题,但我认为您要尝试的是查看mywebsite.com/news/下的所有“帖子”-在这种情况下,只需创建一个名为“新闻”的页面(将子弹/永久链接作为新闻) ),然后在设置>阅读中-将首页设置为“静态页面”,首页选择您的“首页”页面,并将“帖子”页面设置为“新闻”(您刚创建的页面)。

If you are talking about viewing all posts of a custom post type under news, either name the post type slug (under your rewrite array setting when you register the CPT) as News. 如果您要谈论在新闻下查看自定义帖子类型的所有帖子,则将帖子类型slug(在注册CPT时在重写数组设置下)命名为新闻。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM