2017 © Pedro Peláez
 

library wp-helpers

image

geistpress/wp-helpers

  • Thursday, August 24, 2017
  • by PascalKleindienst
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

WP-Helpers

Travis StyleCI Code Climate, (*1)

Installation

$ composer require geistpress/wp-helpers

Usage

Init the Load and View Helper and register Sidebars, (*2)

// Init WP-Helpers
add_action('init', function () {
    // Init Loader
    $loader = new \GeistPress\Helpers\Foundation\Loader();

    // Register all class in sidebars directory with the App\Sidebars namespace
    $loader->register(__DIR__ . '/resources/sidebars', 'App\Sidebars'); 

    // Register only the Bar class and return its instance
    $foobar = $loader->register(\Foo\Bar::class); 

    // Init Views
    \GeistPress\Helpers\Facades\View::init(__DIR__ . '/resources/views/');
});

Registerable

To register a class with the loader the class needs to implement the Registerable interface and contain a register method, (*3)

namespace App\Sidebars;

use GeistPress\Helpers\Foundation\Registerable;

class HeaderBar implements Registerable
{
    /**
     * Register sidebar
     */
    public function register()
    {
        register_sidebar([
            'name'          => __('Header Bar', 'app'),
            'id'            => 'header-bar',
            'description'   => __('Top Bar above the navbar', 'app'),
            'before_widget' => '

', 'after_widget' => '
', ]); } }

Views


// Render /resources/views/breadcrumbs.phtml and pass the variable $current='home' to it \GeistPress\Helpers\Facades\View::render('breadcrumbs', ['current' => 'home']);

The Versions

24/08 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

24/08 2017

v0.1.1

0.1.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

24/08 2017

v0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires