Skip to content

Underpress loader for registering WordPress sidebars

Notifications You must be signed in to change notification settings

Underpin-WP/sidebar-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Underpin Sidebar Loader

Loader That assists with adding sidebars (widget areas) to a WordPress website.

Installation

Using Composer

composer require underpin/sidebar-loader

Manually

This plugin uses a built-in autoloader, so as long as it is required before Underpin, it should work as-expected.

require_once(__DIR__ . '/underpin-sidebars/sidebars.php');

Setup

  1. Install Underpin. See Underpin Docs
  2. Register new sidebars menus as-needed.

Example

A very basic example could look something like this.

// Register sidebar
underpin()->sidebars()->add( 'example-sidebar', [
	'name'        => underpin()->__( 'Human readable name' ),
	'id'          => 'example',
	'description' => underpin()->__( 'Human readable description' ),
] );

Alternatively, you can extend Sidebar and reference the extended class directly, like so:

underpin()->sidebars()->add('sidebar-key','Namespace\To\Class');