关闭
dongyan1974 2016-08-16 22:58
浏览 35
已采纳

将菜单添加到我的WordPress主题footer.php

I'm trying to add a custom footer to my WordPress theme, I upload my static website here and now I trying to make it dynamic, I added my primary menu to WordPress but I don't know how can I exactly add footer to my wordpress theme?

do I have to make another menu and use it here like

$args= array(
    'theme_location' => 'footer'
    );
wp_nav_menu(); ?>

and then register it in function.php or it has another way?

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • dongyin2885 2016-08-16 23:04
    关注

    Updated Answer

    You may want to display it by registering dynamic widget and displaying in your footer.php instead:

    Registering Footer Widget

    register_sidebar( array(
        'name' => 'footer Sidebar 1',
        'id' => 'footer-sidebar-1',
        'description' => 'Appears in the footer area',
        'before_widget' => '<aside id="%1$s" class=" %2$s">',
        'after_widget' => '</aside>',
        'before_title' => '<h4 class="widget-title">',
        'after_title' => '</h4>',
    ) );
    

    displaying Footer widget

    <div class="col-sm-3">
        <?php
            if(is_active_sidebar('footer-sidebar-1')){
                dynamic_sidebar('footer-sidebar-1');
            }
        ?>
    </div>
    

    Then in your Dashboard Widget Menu add your custom code via Text Widget placing into your footer-sidebar-1 sidebar.

    Hope it works..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部