如何更改小部件的HTML代码? 我尝试在sidebar.php中进行一些更改,但没有结果。
如果有任何帮助,我将非常感激。
答案 0 :(得分:10)
它在functions.php文件中定义。您可以通过传递正确的选项轻松更改它
if (function_exists('register_sidebar')) {
$opts = array(
'name' => 'IndexWidgets',
'before_widget' => '<div id="%1$s2" class="home_box %2$s">',
'after_widget' => '</div></div>',
'before_title' => '<h2>',
'after_title' => '</h2><div class="home_box_body">'
);
register_sidebar($opts);
}
这是Wordpress codex链接供参考:http://codex.wordpress.org/Function_Reference/register_sidebar