本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长


+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

小部件问题 - WordPress

发布于2023-09-25 20:30     阅读(263)     评论(0)     点赞(15)     收藏(5)


我已经导入了一个主题,并且在 WordPress 上一切正常。但是,我试图将一个小部件添加到 footer.php 中,但由于某种原因,它没有显示。

我的 footer.php 如下:-

<?php get_sidebar('footer_widget'); ?>

我也将其添加到functions.php中

    function bauhaus_arphabet_widgets_init() {
    register_sidebar( array(
        'name' => esc_html__( 'sidebar', 'bauhaus' ),
        'id' => 'bauhaus_sidebar',
        'before_widget' => '<div id="%1$s" class="widget sidebar_widget %2$s">',
        'after_widget' => '</div>',
        'description' => esc_html__( 'blog sidebar', 'bauhaus' ),
        'before_title' => '<h3 class="widget-title">',
        'after_title' => '</h3>',
    ) );

    register_sidebar( array(
        'name' => __( 'Footer', 'bauhaus' ),
        'id' => 'footer_widget',
        'before_widget' => '<div id="%1$s" class="widget footer_widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>'
    ));
}

有谁知道为什么不显示?

提前谢谢你,斯科特


解决方案


将代码替换为:

<?php dynamic_sidebar( 'footer_widget' ); ?>



所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接:http://www.qianduanheidong.com/blog/article/531603/7511a2072e3f5d120cf2/

来源:前端黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

15 0
收藏该文
已收藏

评论内容:(最多支持255个字符)