Public | Automated Build

Last pushed: a year ago
Short Description
DockerWP
Full Description

Carbonite

Setup

Post Types

To add new post types or taxonomies, Simply copy ( or modify ) lib/Post/Type/ExamplePostType.php :

  • The new post type must extend Carbonite\Post\PostType and implement Carbonite\Post\PostTypeInterface.
  • It should have register() in your class as public function.
  • Create one post type per class, it can have many taxonomies but you should keep it at one post type per class.
  • Register your post type in lib\Post\Register.php

REST Routes & Actions

Since 4.4 WP introduced RESTFul API which makes it super easy to create frontend javascript application, With this new API you can use Angular, Vue.js or any other
JS framework to build frontend application while retrieving data from WP Core.

The REST API endpoint is domain.com/wp-json/

First of all you need to define a namespace for your theme or plugin, Do this by opening lib/REST/REST.php and modifying REST_NAMESPACE constant at top of the class.

This will register following namespace for your ajax and JSONP requests : domain.com/wp-json/example/

To add new Routes and actions, Simply copy ( or modify ) lib/REST/Action/ExampleAction.php :

  • Your class must extend Carbonite\REST\REST and implement Carbonite\REST\RESTActionInterface.
  • It should have register() in your class as public function.
  • Register your routes and actions in register() method using $this->registerRoute() function, It accepts route name and options,
    For complete list of options visit : http://v2.wp-api.org/extending/adding/
  • Try to separate actions by domain logic
  • Register your action in lib/REST/Register.php
Docker Pull Command
Owner
payamb
Source Repository

Comments (0)