Skip to content

Commit

Permalink
add WPML plugin query info for gatsby-source-wordpress plugin (#2973)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravikiran438 authored and sebastienfi committed Nov 20, 2017
1 parent d41ee36 commit 6780cac
Showing 1 changed file with 59 additions and 1 deletion.
60 changes: 59 additions & 1 deletion packages/gatsby-source-wordpress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ These plugins were tested. We welcome PRs adding support for data from other plu
- [x] [ACF](https://www.advancedcustomfields.com/) The option `useACF: true` must be activated in your site's `gatsby-config.js`.
* You must have the plugin [acf-to-rest-api](https://github.com/airesvsg/acf-to-rest-api) installed in WordPress.
* Will pull the `acf: { ... }` fields's contents from any entity which has it attached (pages, posts, medias, ... you choose from in WordPress back-end while creating a Group of Fields).
* [ACF Pro](https://www.advancedcustomfields.com/pro/) same as ACF :
* [ACF Pro](https://www.advancedcustomfields.com/pro/) same as ACF :
* Will work with [Flexible content](https://www.advancedcustomfields.com/resources/flexible-content/) and premium stuff like that (repeater, gallery, ...).
* Will pull the content attached to the [options page](https://www.advancedcustomfields.com/add-ons/options-page/).

- [x] [WP-API-MENUS](https://wordpress.org/plugins/wp-api-menus/) which gives you the menus and menu locations endpoint.

- [x] [WPML-REST-API](https://github.com/shawnhooper/wpml-rest-api) which adds the current locale and available translations to all post types.


## How to use Gatsby with Wordpress.com hosting

Expand Down Expand Up @@ -222,6 +224,62 @@ Mention the apparition of `childWordpressAcfField` in the query below :
}
```

### Query posts with the WPML Fields Node
```graphql
allWordpressPost {
edges {
node {
id
slug
title
content
excerpt
date
modified
author
featured_media
template
categories
tags
wpml_current_locale
wpml_translations {
locale
wordpress_id
post_title
href
}
}
}
}
```

### Query pages with the WPML Fields Node
```graphql
allWordpressPage {
edges {
node {
id
title
content
excerpt
date
modified
slug
author
featured_media
template
wpml_current_locale
wpml_translations {
locale
wordpress_id
post_title
href
}
}
}
}
```

## Site's `gatsby-node.js` example

```javascript
Expand Down

0 comments on commit 6780cac

Please sign in to comment.