innocode-digital / wp-innocode-community
Helps to integrate Innocode Community with a site.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 10
Forks: 0
Open Issues: 0
Type:wordpress-muplugin
Requires
- php: >=7.1
- ext-json: *
- composer/installers: ~1.0
This package is auto-updated.
Last update: 2022-12-05 20:45:17 UTC
README
Description
Helps to integrate Innocode Community with a site.
Install
-
Preferable way is to use Composer:
composer require innocode-digital/wp-innocode-community
By default it will be installed as Must Use Plugin. But it's possible to control with
extra.installer-paths
incomposer.json
. -
Alternate way is to clone this repo to
wp-content/mu-plugins/
orwp-content/plugins/
:cd wp-content/plugins/ git clone git@github.com:innocode-digital/wp-innocode-community.git cd wp-innocode-community/ composer install
If plugin was installed as regular plugin then activate Community from Plugins page
or WP-CLI: wp plugin activate wp-innocode-community
.
Usage
Add required constants (usually to wp-config.php
):
define( 'INNOCODE_COMMUNITY_INSTANCE_URL', '' );
define( 'INNOCODE_COMMUNITY_CONSUMER_TOKEN', '' );
Documentation
Get Innocode Community API object:
innocode_community();
Note: it will trigger an error in case when required constants
INNOCODE_COMMUNITY_INSTANCE_URL
and/or INNOCODE_COMMUNITY_CONSUMER_TOKEN
are missing.
Get a feed:
innocode_community()->get_feed( int $id, array $query_args = [], array $args = [] );
$id
- Feed ID.$query_args
- Query arguments.$args
- Request arguments. See WP_Http::request() for more info.
Perform an HTTP request to the API:
// Performs any HTTP request
innocode_community()->request( string $method, string $path, array $query_args = [], array $args = [] );
// Performs GET HTTP request
innocode_community()->get( string $path, array $query_args = [], array $args = [] );
$method
- Request method. AcceptsGET
,POST
,HEAD
,PUT
,DELETE
,TRACE
,OPTIONS
, orPATCH
.$path
- Endpoint path.$query_args
- Query arguments.$args
- Request arguments. See WP_Http::request() for more details.
REST API
HTTP method | Endpoint | Function |
---|---|---|
GET | /innocode/v1/community/feeds/<id> |
Retrieves a feed from Community through API. |
Request Parameters
Name | Type | Description |
---|---|---|
id | int | Feed ID. Required |