duanjian5059
2016-08-16 19:38
浏览 65
已采纳

如何在Wordpress中组合小部件

I'm trying to merge two widgets that show on the same row (left and right) the template is build to host text on the left and a gravity form on the right. I want instead a full width area without splitting the row in two columns.

The template does this (nasty imo) also in other areas but has some pros that I wish to preserve. How hard would be to turn it into a full width area (1 widget) and what steps should I follow?

图片转代码服务由CSDN问答提供 功能建议

我正在尝试合并两个小部件,这些小部件显示在构建模板的同一行(左侧和右侧)上 主页文本在左侧,重力形式在右侧。 我想要一个全宽度的区域,而不是将行分成两列。

模板在其他区域也做了这个(讨厌的imo),但有一些我希望保留的专业。 把它变成一个全宽度区域(1个小部件)有多难,我应该遵循哪些步骤?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dtlh12053 2016-08-16 19:59
    已采纳

    You would create a child theme and then overwrite the template that is being used to create the widget area. You should also disable the widget location that you are removing so that it isn't shown in the admin. You can use the following code to remove the widget area.

    function remove_some_widgets(){
        unregister_sidebar( 'first-footer-widget-area' );
    }
    add_action( 'widgets_init', 'remove_some_widgets', 11 );
    

    You would replace 'first-footer-widget-area' with the identifier for the widget area you are removing.

    I can't give a code example for combining the widget areas because it would depend on the code available in your theme. In case you don't have a child theme, here is a link for how to create one: https://codex.wordpress.org/Child_Themes

    点赞 评论

相关推荐 更多相似问题