如何在wordpress中为分类术语页面创建子页面?

问题描述

我创建了自定义分类法以及术语页面的外观。

domain.com/taxonomy/term

但是对于每个分类术语,我都包含了各种自定义字段内容内容很大,我想通过单独的链接点击将它们显示在子页面中。我想在子页面显示它们。

例如:

domain.com/taxonomy/term/Meta-data-1

domain.com/taxonomy/term/Meta-data-2

我该如何创建?

我正在使用 Genesis 框架

解决方法

我假设您对 php 和 Wordpress 主题有一定的了解。

您可以创建/添加一个 custom-subterm,然后为该 template 创建一个名为 custom-subterm 的特定 taxonomy-custom-subterm.php
在里面,您可以向 custom-term 显示所有相关信息/元数据。

如果您的 custom-taxonomy 设置为 hierachical(我认为这是默认行为),则网址应为 /custom-taxonomy/custom-term/custom-subterm/


图形表示

domain.com/
  L custom-taxonomy/
    L custom-term/ (using taxonomy.php OR taxonomy-custom-term.php as template)
      L custom-subterm/ (using taxonomy-custom-subterm.php as template)

这是基于默认的 Wordpress 层次结构。
了解更多@https://developer.wordpress.org/themes/basics/template-hierarchy/
还有@https://developer.wordpress.org/files/2014/10/Screenshot-2019-01-23-00.20.04.png