Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何在wordpress侧栏中的ul标记周围添加div类包装器_Html_Wordpress_Sidebar - Fatal编程技术网

Html 如何在wordpress侧栏中的ul标记周围添加div类包装器

Html 如何在wordpress侧栏中的ul标记周围添加div类包装器,html,wordpress,sidebar,Html,Wordpress,Sidebar,我想在ultagwordpress侧边栏周围添加一个div包装标签。 默认情况下,我看到的边栏代码如下所示 元 内容 内容 我想要这样的东西: 元 内容 内容 我的PHP代码: if(函数_存在('register_边栏')){ 寄存器侧栏(数组)( '名称'=>'右侧边栏底部', 'id'=>'sidebar-1', “说明”=>“无说明”, '在小部件'=>''之前, 'after_widget'=>'虽然使用类似jQuery的东西包装子菜单很容易,但使用jQuery包装子菜

我想在
ul
tagwordpress侧边栏周围添加一个div包装标签。 默认情况下,我看到的边栏代码如下所示

  • 内容
  • 内容
我想要这样的东西:

  • 内容
  • 内容
我的PHP代码:

if(函数_存在('register_边栏')){
寄存器侧栏(数组)(
'名称'=>'右侧边栏底部',
'id'=>'sidebar-1',
“说明”=>“无说明”,
'在小部件'=>''之前,

'after_widget'=>'虽然使用类似jQuery的东西包装子菜单很容易,但使用jQuery包装子菜单并不是一种好的做法。请将其放在functions.php中:

class Child_Wrap extends Walker_Nav_Menu
{
    function start_lvl(&$output, $depth)
    {
        $indent = str_repeat("\t", $depth);
        $output .= "\n$indent<div class=\"custom-sub\"><ul class=\"sub-menu\">\n";
    }
    function end_lvl(&$output, $depth)
    {
        $indent = str_repeat("\t", $depth);
        $output .= "$indent</ul></div>\n";
    }
}

您应该可以只修改已注册的侧栏。注意:我没有在下面的代码中检查\n是否在那里工作

'after_widget' => '</div></div>',
'after_title' => '</h2>\n <div class="THIS IS THE WRAPPER WHAT I WANT">',
'after_widget'=>'',
'在标题'=>'\n'之后,

做以下两件事:

“标题”后面的“=>”,

在_widget'=>''之后,
你能在这里分享你的php代码吗
'after_widget' => '</div></div>',
'after_title' => '</h2>\n <div class="THIS IS THE WRAPPER WHAT I WANT">',