Directory

← Back

wordpress-collect

Webcomponent for interacting with the Wordpress REST API

Author

Contributors

Rating

[ This description is mirrored from README.md at github.com/rocketsciencesolutions/wordpress-collect on 2018-01-17 ]

Build status Published on webcomponents.org js-standard-style

<wordpress-collect>

The wordpress-collect element makes it possible to interact with the native WP REST API.

Table of Contents

1 Install the element in your project
2 Usage
2.1 Attribute: base-url - required
2.2 Attribute: resource - required
2.3 Attribute: id - optional
2.4 Attribute: response - required
2.5 Attribute: wp-api-url - optional

1 Installation

bower install --save wordpress-posts

2 Usage

<wordpress-collect
      base-url="https://yourwordpressurl.com"
      resource="pages"
      response="{{wpPages}}"></wordpress-collect>

<template
      is="dom-repeat"
      items="[[wpPages]]"
      as="page">
      <div>
            <h1>[[page.title.rendered]]</h1>
            <div>[[page.content.rendered]]</div>
      </div>
</template>

2.1 base-url - required

The required base-url attribute is the Wordpress url you want to retrieve the data from.

2.2 resource - required

The required resource attribute indicates the kind of resource to retrieve. This can be pages | posts or other resources defined in the WP REST API reference.

2.3 id - optional

The optional id attribute can be set to request a specific data object, like a page with the id 5.

2.4 response - required

When data is received the binding in the response attribute is updated with the retrieved data and available for use in the component which wordpress-collect is situated.

2.5 wp-api-url - optional

Optionally you can set the wp-api-url attribute. When not defined it will always default to wp-json/wp/v2, which is the default WP REST API segment. The wp-api-url attribute will be appended to the base-url.

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Dependencies

Polymer/polymer#^2.0.0

  • iron-ajax#^2.0.5
Released
2017-09-17
Maturity
TESTED
License
Other

Compatibility

Framework
Polymer 2.0+
Browser
Browser Independent

wordpress-collect - Vaadin Add-on Directory

Webcomponent for interacting with the Wordpress REST API wordpress-collect - Vaadin Add-on Directory
Online