Sidebar
in package
Sidebar Module class.
Table of Contents
Properties
- $action_hook : ActionHook
- ActionHook instance.
- $args : array<string|int, mixed>|string
- Array of arguments for registering a sidebar.
Methods
- __construct() : mixed
- Constructor.
- __toString() : string
- Custom toString magic method.
- register_sidebar() : void
- Registers the sidebar with WordPress.
- initialize() : void
- Initializes the sidebar.
Properties
$action_hook
ActionHook instance.
private
ActionHook
$action_hook
ActionHook object for the register_sidebar method.
Tags
$args
Array of arguments for registering a sidebar.
private
array<string|int, mixed>|string
$args
Array or query string of arguments for registering a sidebar.
Tags
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $args[, ActionHook $action_hook = null ]) : mixed
Constructs the Sidebar object by setting the arguments and action hook.
Parameters
- $args : array<string|int, mixed>
-
Array of arguments for registering a sidebar.
- $action_hook : ActionHook = null
-
Optional. ActionHook instance. Default 'widgets_init'.
Tags
__toString()
Custom toString magic method.
public
__toString() : string
Returns the sidebar as a JSON string.
Tags
Return values
string —JSON string.
register_sidebar()
Registers the sidebar with WordPress.
public
register_sidebar() : void
Uses the register_sidebar()
function to register the sidebar.
Tags
initialize()
Initializes the sidebar.
private
initialize() : void
Hooks the action to register the sidebar and adds the sidebar to the registry.