个性化阅读
专注于IT技术分析

WordPress:无法更改`the_widget` args

嗨, 大家好, 我正在尝试将_widget函数上的h2更改为h5, 我希望将其作为有用的链接显示在404页上, 但无法正常工作:

<?php
$args = array(
    'before_widget' => '<div class="widget %s">', 'after_widget' => '</div>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>'
);
the_widget('WP_Widget_Pages', $args);
?>

我已经尝试了以上内容, 但没有任何变化。有人可以帮忙吗?我是WordPress的新手。谢谢。


#1


我通常这样做:

add_action( 'widgets_init', 'theme_slug_widgets_init' );
function theme_slug_widgets_init() {
    register_sidebar( array(
        'name' => 'my_sidebar_1', 'id' => 'sidebar_1', 'description' => __( 'Widgets in this area will be shown on all blog posts.', 'theme-slug' ), 'before_widget' => '<div class="widgetwrapper">', 'after_widget'  => '</div>', 'before_title'  => '<h5 class="widget-title">', 'after_title'   => '</h5>', ) );
}
赞(0)
未经允许不得转载:srcmini » WordPress:无法更改`the_widget` args

评论 抢沙发

评论前必须登录!