In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you WordPress used to create and obtain the sidebar of the PHP functions, I believe most people do not know much, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
Register_sidebar () (create sidebar)
Create a sidebar to place gadgets. When using this function, please put it in a function and mount it to the "widgets_init" hook.
Usage
Register_sidebar ($args)
Parameters.
$args
(string | Array) (optional) the parameters of the sidebar to create.
Default value:
$args = array ('name' = > _ (' Sidebar name', 'theme_text_domain'),' id' = > 'unique-sidebar-id',' description' = >'', 'class' = >', 'before_widget' = >', 'after_widget' = >', 'before_title' = >', 'after_title' = >')
Array parameters introduction:
Name: sidebar name
Id: sidebar ID, which must be lowercase. Default is incremental array ID.
Description: sidebar description
Class: extra class for gadgets
Before_widget: the Html code at the beginning of the gadget inside
After_widget: the Html code at the end of the gadget inside
Before_title: the beginning Html code of the title of the gadget inside
After_title: the Html code at the end of the title of the gadget inside
Examples
Register_sidebar (array ('name' = > _ (' right sidebar'), 'id' = >' sidebar-1', 'description' = > _ _' right sidebar gadget. ), 'before_title' = >'', 'after_title' = >',))
Other
This function is located at: wp-includes/widgets.php
Get_sidebar () (get sidebar)
Get_sidebar () is used to introduce a sidebar template. If the name is specified, the sidebar- {name} .php file of the root directory of the current theme is introduced, the sidebar.php file of the root directory of the current theme is introduced if not specified, and the wp-includes/theme-compat/sidebar.php file is introduced if the file does not exist.
Usage
Get_sidebar ($name)
Parameters.
$name
(string) (optional) introduces the name of the template or, if specified, the sidebar- {$name} .php file of the root directory of the current theme.
Default value: None
Examples
The following code introduces the sidebar.php file of the root directory of the current topic:
The following code introduces the sidebar-left.php file of the root directory of the current topic:
The following example introduces the left sidebar (sidebar-left.php) and the right sidebar (sidebar-right.php), respectively:
Content and content
Other
This function is located at: wp-includes/general-template.php
This is all of the article "what are the PHP functions used to create and get sidebars in WordPress?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.