如何使用漂亮的永久链接整理帖子[wordpress]

时间:2015-04-23 18:57:52

标签: php wordpress permalinks

我做了很多研究,发现了很多解决方案几乎解决了我的问题,但没有一个能100%完成。

最重要的部分是永久链接 使用自定义帖子没有任何方法可以使永久链接权利。

它无法使用类别,因为即使是小孩,您也无法复制类别。 我尝试只添加分类法,我尝试使用自定义分类法自定义帖子

我可以拥有"产品","软件"和" cad",因为如果您选择几个类别,链接上只会显示一个

我想要那样的东西。 创建一个帖子,然后选择类别,结果将类似于下面的列表

courses
|
|-cad
|   |
|   |-software one      mysite.com/courses/cad/software-one
|   |-software two      mysite.com/courses/cad/software-two
|   |-software three    mysite.com/courses/cad/software-three
|   
|-cae
|   |
|   |-software one      mysite.com/courses/cae/software-one
|   |-software two      mysite.com/courses/cae/software-two
|   |-software three    mysite.com/courses/cae/software-three
|
|-cam
|   |
|   |-software one      mysite.com/courses/cam/software-one
|   |-software two      mysite.com/courses/cam/software-two
|   |-software three    mysite.com/courses/cam/software-three

products
|
|-cad
|   |
|   |-software one      mysite.com/products/cad/software-one
|   |-software two      mysite.com/products/cad/software-two
|   |-software three    mysite.com/products/cad/software-three
|   
|-cae
|   |
|   |-software one      mysite.com/products/cae/software-one
|   |-software two      mysite.com/products/cae/software-two
|   |-software three    mysite.com/products/cae/software-three
|
|-cam
|   |
|   |-software one      mysite.com/products/cam/software-one
|   |-software two      mysite.com/products/cam/software-two
|   |-software three    mysite.com/products/cam/software-three

services
|
|-cad
|   |
|   |-software one      mysite.com/services/cad/software-one
|   |-software two      mysite.com/services/cad/software-one
|   |-software three    mysite.com/services/cad/software-one
|   
|-cae
|   |
|   |-software one      mysite.com/services/cae/software-one
|   |-software two      mysite.com/services/cae/software-one
|   |-software three    mysite.com/services/cae/software-one
|
|-cam
|   |
|   |-software one      mysite.com/services/cam/software-one
|   |-software two      mysite.com/services/cam/software-one
|   |-software three    mysite.com/services/cam/software-one

我将有更多深度与重复的cotegories链接。

之类的东西
mysite.com/product/cad/software-one/version-x
mysite.com/product/cad/software-one/version-y
mysite.com/product/cad/software-one/version-z

1 个答案:

答案 0 :(得分:0)

  1. 设置正确的永久链接结构。转到/wp-admin/options-permalink.php并选择/%category%/%postname%/表单的自定义永久链接,保存在底部。

  2. 设置正确的标记结构。转到/wp-admin/edit-tags.php?taxonomy=category并创建三个标记:

    • courses
    • products
    • services

    然后通过从下拉列表中选择适当的父标记,将类别创建为这些标记的子级:

    • cad
    • cam
  3. 创建帖子时,请选择适用的最内层标记,而不是父标记。

    您的帖子现在应该有永久链接/courses/cad/software-one/,例如。