2017 © Pedro Peláez
 

library zero-library-shortcodes

Addon for zero library to build wordpress shortcodes faster.

image

gwa/zero-library-shortcodes

Addon for zero library to build wordpress shortcodes faster.

  • Thursday, November 5, 2015
  • by gwa
  • Repository
  • 2 Watchers
  • 0 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

zero-library-shortcodes

Latest Version on Packagist Total Downloads Software License, (*1)

Master

Build Status Coverage Status Quality Score, (*2)

Develop

Build Status Coverage Status Quality Score, (*3)

Install

Via Composer, (*4)

``` bash $ composer require gwa/zero-library-shortcodes, (*5)


## Usage First you need to extend RendererData and create a getDefaults function. ``` php use Gwa\Wordpress\Template\Zero\Library\Shortcodes\RendererData; class CardData extends RendererData { public function getDefaults() { return [ 'title' => null, 'btn' => null, 'url' => null, ]; } }

Now we extend the Renderer and add some values for some keys., (*6)

``` php, (*7)

use Gwa\Wordpress\Template\Zero\Library\Shortcodes\Renderer;, (*8)

class CardRenderer extends Renderer { public function render() { return $this->get('title'); } }, (*9)


Last thing now is to create a shortcode class. ``` php use Gwa\Wordpress\Template\Zero\Library\Shortcodes\Shortcode; class CardShortcode extends Shortcode { public $atts = [ 'title' => '' ]; public function getShortcode() { return 'card'; } public function render($atts) { $attr = $this->getWpBridge()->shortcodeAtts($this->atts, $atts); return = (new CardRenderer())->setRendererData($this->getData())->render(); } protected function getData() { $renderdata = new CardData(); $renderdata->set('content', $this->getContent($id)) ->set('url', 'http://google.com/') ->set('title', 'google'); return $renderdata; } }

Register you plugin., (*10)

``` php use Gwa\Wordpress\MockeryWpBridge\WpBridge;, (*11)

(new CardShortcode())->setWpBridge(new WpBridge())->init();, (*12)


## Change log Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. ## Testing ``` bash $ composer test

Contributing

Please see CONTRIBUTING for details., (*13)

Credits

License

The MIT License (MIT). Please see License File for more information., (*14)

The Versions

05/11 2015

dev-master

9999999-dev https://github.com/gwa/zero-library-shortcodes

Addon for zero library to build wordpress shortcodes faster.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress library shortcode zero zero-library gwa

05/11 2015

v1.3.0

1.3.0.0 https://github.com/gwa/zero-library-shortcodes

Addon for zero library to build wordpress shortcodes faster.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress library shortcode zero zero-library gwa

05/11 2015

dev-develop

dev-develop https://github.com/gwa/zero-library-shortcodes

Addon for zero library to build wordpress shortcodes faster.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress library shortcode zero zero-library gwa

05/11 2015

v1.2.0

1.2.0.0 https://github.com/gwa/zero-library-shortcodes

Addon for zero library to build wordpress shortcodes faster.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress library shortcode zero zero-library gwa

04/11 2015

v1.1.0

1.1.0.0 https://github.com/gwa/zero-library-shortcodes

Addon for zero library to build wordpress shortcodes faster.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress library shortcode zero zero-library gwa

04/11 2015

v1.0.0

1.0.0.0 https://github.com/gwa/zero-library-shortcodes

Addon for zero library to build wordpress shortcodes faster.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress library shortcode zero zero-library gwa