简体   繁体   English

WordPress的页面永久链接重写

[英]Wordpress pages permalink rewrite

I have WooCommerce installed already and the category url of WooCommerce is like this: 我已经安装了WooCommerce,WooCommerce的类别网址是这样的:

url.com/product-category/category1 works fine for displaying the category. url.com/product-category/category1可以很好地显示类别。

This is what I am aiming to achieve. 这是我的目标。 url.com/product-category/category1/pagename url.com/product-category/category1/pagename

category1 is the name of the category which is set in the page back-end in custom field. category1是在自定义字段的页面后端中设置的类别的名称。

pagename is the name of the page. pagename是页面的名称。

You can Organizing Your Pages with Parent page 您可以使用父页面来组织页面

To create a subpage 创建子页面

  1. Go to Administration > Pages > Add New screen. 转到管理>页面>添加新屏幕。
  2. In the right menu, click the "Page Parent" drop-down menu. 在右侧菜单中,单击“页面父级”下拉菜单。 The drop-down menu contains a list of all the Pages already created for your site. 下拉菜单包含已为您的站点创建的所有页面的列表。
  3. Select the appropriate parent Page from the drop-down menu to make the current Page a child Page. 从下拉菜单中选择适当的父页面,以使当前页面成为子页面。
  4. Add content to the subpage. 将内容添加到子页面。
  5. Click Publish when ready. 准备好后,单击发布。

When your Pages are listed, the Child Page will be nested under the Parent Page. 列出您的页面后,子页面将嵌套在父页面下。 The Permalinks of your Pages will also reflect this Page hierarchy. 页面的永久链接也将反映此页面层次结构。

I looked for same solution to custom post type and found a lot codesnippet solutions for category functions here. 我在寻找与自定义帖子类型相同的解决方案,并在此处找到了很多针对类别功能的代码片段解决方案。 But i will just recommend rewrites at manageable permalink like https://wordpress.org/plugins/advanced-permalinks/ . 但我只会建议以可管理的永久链接进行重写,例如https://wordpress.org/plugins/advanced-permalinks/ However checking out categories URL codex might be more slim option. 但是,签出类别URL Codex可能是更苗条的选择。

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

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