Sidebars |
您所在的位置:网站首页 › 今天曼城比赛时间表 › Sidebars |
Browse:
Home /
Theme Handbook /
Theme Functionality / Sidebars
Sidebars
TopicsWhat are Sidebars
Registering a Sidebar
Examples
Displaying Sidebars in your Theme
Create a Sidebar Template File
Example:
Load your Sidebar
Customizing your Sidebar
Display Default Sidebar Content
Display Default Widgets
What are Sidebars
A sidebar is any widgetized area of your theme. Widget areas are places in your theme where users can add their own widgets. You do not need to include a sidebar in your theme, but including a sidebar means users can add content to the widget areas through the Customizer or the Widgets Admin Panel. Widgets can be employed for a variety of purposes, ranging from listing recent posts to conducting live chats. Tip: The name “sidebars” comes from a time when widget areas were normally created in a long strip to the lefthand or righthand side of a blog. Today, sidebars have evolved beyond their original name. They can be included anywhere on your website. Think of a sidebar as any area that contains widgets.Top ↑ Registering a SidebarTo use sidebars, you must register them in functions.php. To begin, register_sidebar() has several parameters that should always be defined regardless of whether they are marked as optional. These include x, y, and z. name – your name for the sidebar. This is the name users will see in the Widgets panel. id – must be lowercase. You will call this in your theme using the dynamic_sidebar function. description – A description of the sidebar. This will also be shown in the admin Widgets panel. class – The CSS class name to assign to the widget’s HTML. before_widget – HTML that is placed before every widget. after_widget – HTML that is placed after every widget. Should be used to close tags from before_widget. before_title – HTML that is placed before the title of each widget, such as a header tag. after_title – HTML that is placed after every title. Should be used to close tags from before_title.To register a sidebar we use register_sidebar and the widgets_init function. |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |