首页 WordPress函数大全 register_sidebar()

register_sidebar()

2020-05-02 / 2282阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

register_sidebar( array|string $args = array() )

构建单个边栏的定义并返回ID。

描述

接受字符串或数组,然后根据新边栏的一组默认参数对其进行解析。WordPress将基于> add_theme_support()自动生成侧边栏ID和名称

参数

$args

(array|string)
(Optional)
Array or string of arguments for the sidebar being registered.

  • 'name'
    (string) The name or title of the sidebar displayed in the Widgets interface. Default 'Sidebar $instance'.
  • 'id'
    (string) The unique identifier by which the sidebar will be called. Default 'sidebar-$instance'.
  • 'description'
    (string) Description of the sidebar, displayed in the Widgets interface. Default empty string.
  • 'class'
    (string) Extra CSS class to assign to the sidebar in the Widgets interface.
  • 'before_widget'
    (string) HTML content to prepend to each widget's HTML output when assigned to this sidebar. Default is an opening list item element.
  • 'after_widget'
    (string) HTML content to append to each widget's HTML output when assigned to this sidebar. Default is a closing list item element.
  • 'before_title'
    (string) HTML content to prepend to the sidebar title when displayed. Default is an opening h2 element.
  • 'after_title'
    (string) HTML content to append to the sidebar title when displayed. Default is a closing h2 element.

Default value: array()

返回

(string) Sidebar ID added to $wp_registered_sidebars global.

大家谈论
    我的见解