Navigation
in package
Navigation Module class.
Table of Contents
Properties
- $action_hook : ActionHook
- ActionHook instance.
- $description : string
- Navigation description.
- $location : string
- Navigation location.
- $register_menu : bool
- Whether to register the navigation menu.
Methods
- __construct() : mixed
- Constructor.
- __toString() : string
- Custom toString magic method.
- register_nav_menu() : mixed
- Registers the navigation with WordPress.
- initialize() : void
- Initializes the navigation.
Properties
$action_hook
ActionHook instance.
private
ActionHook
$action_hook
ActionHook object for the register_nav_menu method.
Tags
$description
Navigation description.
private
string
$description
Navigation description.
Tags
$location
Navigation location.
private
string
$location
Navigation location.
Tags
$register_menu
Whether to register the navigation menu.
private
bool
$register_menu
Whether to register the navigation menu.
Tags
Methods
__construct()
Constructor.
public
__construct(string $location, string $description[, ActionHook $action_hook = null ][, bool $register_menu = true ]) : mixed
Constructs the Navigation object by setting the location, description, and action hook.
Parameters
- $location : string
-
Navigation location.
- $description : string
-
Navigation description.
- $action_hook : ActionHook = null
-
Optional. ActionHook instance. Default 'init'.
- $register_menu : bool = true
-
Optional. Whether to register the navigation menu. Default true.
Tags
__toString()
Custom toString magic method.
public
__toString() : string
Returns the navigation as a JSON string.
Tags
Return values
string —JSON string.
register_nav_menu()
Registers the navigation with WordPress.
public
register_nav_menu() : mixed
Uses the register_nav_menu()
function to register the navigation.
Tags
initialize()
Initializes the navigation.
private
initialize() : void
Hooks the action to register the navigation and adds the navigation to the registry.