2017 © Pedro Peláez
 

library wp-endpoints-static

Generic but customisable endpoint to expose our static data via WP-API.

image

moxie-leean/wp-endpoints-static

Generic but customisable endpoint to expose our static data via WP-API.

  • Thursday, April 21, 2016
  • by moxieDeveloper
  • Repository
  • 5 Watchers
  • 1 Stars
  • 212 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

WP Endpoints: Static

Generic but customisable endpoint to expose our static data via WP-API. This extension will create an endpoint (at /wp-json/leean/v1/static by default)., (*1)

The endpoint takes a no parameters and returns the following data:, (*2)

  • Site name
  • Site tagline
  • Menus
    • Menu location
      • Menu items
  • Widgets

Getting Started

The easiest way to install this package is by using composer from your terminal:, (*3)

composer require moxie-leean/wp-endpoints-static

Or by adding the following lines on your composer.json file, (*4)

"require": {
  "moxie-leean/wp-endpoints-static": "dev-master"
}

This will download the files from the packagist site and set you up with the latest version located on master branch of the repository., (*5)

After that you can include the autoload.php file in order to be able to autoload the class during the object creation., (*6)

include '/vendor/autoload.php';

Finally you need to initialise the endpoint by adding this to your code:, (*7)

\Leean\Endpoints\StaticApi::init();

Usage

The extension has a number of filters which can be used to customised the output. In addition it does some useful extra manipulation of ACF data to make it more useful to a front-end app., (*8)

Filters

Common parameters passed by many filers are:, (*9)

  • $endpoint : the name of the endpoint. Always '/static' for this extension.

ln_endpoints_api_namespace

Customise the API namespace ('leean' in /wp-json/leean/v1/static), (*10)

add_filter( 'ln_endpoints_api_namespace', function( $namespace, $endpoint ) {
    return 'my-app';
}, 10, 2 );

ln_endpoints_api_version

Customise the API version ('v1' in /wp-json/leean/v1/static), (*11)

add_filter( 'ln_endpoints_api_version', function( $version, $endpoint ) {
    return 'v2';
}, 10, 2 );

ln_endpoints_data

Customise the results just before they are sent., (*12)

add_filter( 'ln_endpoints_data', function( $data, $endpoint ) {
    $data['site_title] = 'New Title;
    return $data;
}, 10, 3 );

The Versions

21/04 2016

dev-master

9999999-dev https://github.com/moxie-leean/wp-endpoints-static

Generic but customisable endpoint to expose our static data via WP-API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Fenton

wordpress api

18/04 2016

0.1.5

0.1.5.0 https://github.com/moxie-leean/wp-endpoints-static

Generic but customisable endpoint to expose our static data via WP-API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Fenton

wordpress api

07/04 2016

0.1.4

0.1.4.0 https://github.com/moxie-leean/wp-endpoints-static

Generic but customisable endpoint to expose our static data via WP-API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Fenton

wordpress api

06/04 2016

0.1.3

0.1.3.0 https://github.com/moxie-leean/wp-endpoints-static

Generic but customisable endpoint to expose our static data via WP-API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Fenton

wordpress api

30/03 2016

0.1.2

0.1.2.0 https://github.com/moxie-leean/wp-endpoints-static

Generic but customisable endpoint to expose our static data via WP-API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Fenton

wordpress api

24/03 2016

0.1.1

0.1.1.0 https://github.com/moxie-leean/wp-endpoints-static

Generic but customisable endpoint to expose our static data via WP-API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Fenton

wordpress api

23/03 2016

0.1.0

0.1.0.0 https://github.com/moxie-leean/wp-endpoints-static

Generic but customisable endpoint to expose our static data via WP-API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Fenton

wordpress api