<small id='7F7Hi'></small><noframes id='7F7Hi'>

      <i id='7F7Hi'><tr id='7F7Hi'><dt id='7F7Hi'><q id='7F7Hi'><span id='7F7Hi'><b id='7F7Hi'><form id='7F7Hi'><ins id='7F7Hi'></ins><ul id='7F7Hi'></ul><sub id='7F7Hi'></sub></form><legend id='7F7Hi'></legend><bdo id='7F7Hi'><pre id='7F7Hi'><center id='7F7Hi'></center></pre></bdo></b><th id='7F7Hi'></th></span></q></dt></tr></i><div id='7F7Hi'><tfoot id='7F7Hi'></tfoot><dl id='7F7Hi'><fieldset id='7F7Hi'></fieldset></dl></div>

        <legend id='7F7Hi'><style id='7F7Hi'><dir id='7F7Hi'><q id='7F7Hi'></q></dir></style></legend>
        <tfoot id='7F7Hi'></tfoot>
          <bdo id='7F7Hi'></bdo><ul id='7F7Hi'></ul>
      1. 在 wordpress 的子菜单中单击时子菜单消失

        时间:2023-10-11
      2. <legend id='lzBLA'><style id='lzBLA'><dir id='lzBLA'><q id='lzBLA'></q></dir></style></legend>
          <i id='lzBLA'><tr id='lzBLA'><dt id='lzBLA'><q id='lzBLA'><span id='lzBLA'><b id='lzBLA'><form id='lzBLA'><ins id='lzBLA'></ins><ul id='lzBLA'></ul><sub id='lzBLA'></sub></form><legend id='lzBLA'></legend><bdo id='lzBLA'><pre id='lzBLA'><center id='lzBLA'></center></pre></bdo></b><th id='lzBLA'></th></span></q></dt></tr></i><div id='lzBLA'><tfoot id='lzBLA'></tfoot><dl id='lzBLA'><fieldset id='lzBLA'></fieldset></dl></div>

            1. <tfoot id='lzBLA'></tfoot>
                <tbody id='lzBLA'></tbody>
                <bdo id='lzBLA'></bdo><ul id='lzBLA'></ul>

                <small id='lzBLA'></small><noframes id='lzBLA'>

                  本文介绍了在 wordpress 的子菜单中单击时子菜单消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是我为 wordpress 主题中的菜单和子菜单编写的服装功能,但是在我测试之后,当我单击子菜单时,子菜单消失了,因为 wordpress 没有将类别与子类别分开,因此它们是cat",这意味着当我点击一个子菜单时,创建子菜单的函数会检查 url 中的 cat=id 是否有子类别,但它没有,因为它是一个子类别,我是 wordpress 的新手我不知道如何处理这个:

                  Here are my costume functions that I wrote for the menu and submenu in my wordpress theme, but after I tested it the submenu disappeared when I clicked on a submenu, because wordpress doesn't separate categories from subcategories, so the parameter for them is "cat", which means that when I click on a submenu then the function that creates the submenu checks if cat=id in the url has child categories but it doesn't because it is a child category, I am new into wordpress and I don't know how to deal with this:

                  function costume_menu() {
                  $categories =  get_categories('hide_empty=0&style=none&parent=0'); 
                    foreach ($categories as $category) {
                      (is_category($category->term_id)) ? $active = 'class="active_menu"' : $active = '';
                      $nav = '<li>';
                      $nav .= '<a '.$active.'href="'.get_category_link($category->term_id).'">'.strtoupper($category->cat_name).'</a>';
                      $nav .= '</li>';
                  
                      echo $nav;
                    }
                  
                  }
                  
                  function costume_submenu($cat) {
                  
                  $categories =  get_categories("child_of=$cat&hide_empty=0"); 
                    foreach ($categories as $category) {
                      (is_category($category->term_id)) ? $active = 'class="active_menu"' : $active = '';
                      $nav = '<li>';
                      $nav .= '<a '.$active.'href="'.get_category_link($category->term_id).'">'.strtoupper($category->cat_name).'</a>';
                      $nav .= '</li>';
                  
                      echo $nav;
                    }
                  }
                  

                  推荐答案

                  您希望您的菜单是什么样的?

                  What would you like your menu to look like?

                  • 父类别a(当前)所以显示所有
                    • 子类别a(当前)所以显示所有
                      • 子子猫

                      如果这是最终结果,那么我们需要的是

                      If this be the end result then what we need is to

                      1. 从 URL 中获取 category 参数
                      2. 实现一个递归函数来遍历所有类别.
                      3. 重要的是,我们还需要获得该类别的后代才能判断该菜单应显示其孩子或孩子的孩子是否已选择.

                      如果您愿意,可以了解更多详细信息.

                      More exact detail to follow if you wish.

                      这篇关于在 wordpress 的子菜单中单击时子菜单消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 opencart 的导航菜单中添加信息链接? 下一篇:Mysql/php 树形导航菜单

                  相关文章

                    <small id='1az40'></small><noframes id='1az40'>

                    <i id='1az40'><tr id='1az40'><dt id='1az40'><q id='1az40'><span id='1az40'><b id='1az40'><form id='1az40'><ins id='1az40'></ins><ul id='1az40'></ul><sub id='1az40'></sub></form><legend id='1az40'></legend><bdo id='1az40'><pre id='1az40'><center id='1az40'></center></pre></bdo></b><th id='1az40'></th></span></q></dt></tr></i><div id='1az40'><tfoot id='1az40'></tfoot><dl id='1az40'><fieldset id='1az40'></fieldset></dl></div>
                    <tfoot id='1az40'></tfoot>

                      • <bdo id='1az40'></bdo><ul id='1az40'></ul>
                      <legend id='1az40'><style id='1az40'><dir id='1az40'><q id='1az40'></q></dir></style></legend>