显示在 WordPress 中单击的类别层次结构,带有图像和描述

Showing the category hierarchy as clicked in WordPress, with image and desc

有一个非常破旧的问题,我相信解决方案很简单,但我不太习惯 wordpress,无法解决这个问题。

我有一个 WordPress 主题,如果需要,我可以将其更改为任何其他讲解员。

我有的是

我的 wordpress 中有一些类别,它们有 child,child 有 child,它达到 4 个等级。 喜欢

Book
-Novel
--book name
---chapter 1
---chapter 2

Article 
-about life
--life article 1
--life article 2

等等等这只是一个简单的例子。

现在我想要的是

i want to show the list of main categories with its image and description on the home page and when clicked on a category show its child and when clicked on a child show its child on next page and so on. at the end the final post.

对于类别图像,我在 wordpress 中添加了一个名为类别图像的插件。

我试图在一些插件的帮助下在主页上显示类别列表,例如 [categories] 这个简短的代码有助于显示类别列表,但我也想显示图像,单击时的说明和层次结构。

如果有人能给我任何意见、帮助或任何建议,我将非常高兴。我仍在努力 post 在这里取得任何进展。谢谢

我要找的是

When clicked on fiction category open all the books in that category and then when clicked on a book name open all the chapters and then when clicked on a chapter open the post

what i need is i think very simple, just a hierarchy of category when clicked. like if i click on novel all the books in novel category should open and then when i click on any book all the chapters of the book should open and then clicked on chapter the post should open.

  1. 使用 Taxonomy Images 插件而不是您的插件来显示图像

  2. 然后,使用下面的Link来显示分类

然后,使用下面的代码显示您的子类别...

<?php 
        $term_children = get_terms(
            'product-cat',
            array(
                'parent' => get_queried_object_id(),
                'hide_empty' => false,
            )
        );
       if (!empty($term_children)) { ?>
       <ul>
                <?php 
                    if ( ! is_wp_error( $terms ) ) {
                        foreach ( $term_children as $child ) {
                            echo '<li><a href="'.get_term_link( $child ).'">'.$child->name.'</a></li>';
                        }
                    }
                ?>
       </ul>
      <?php } ?>