Skip to content

Commit 0cf6866

Browse files
Ramsay LanierRamsay Lanier
authored andcommitted
update readme
1 parent 16d0dec commit 0cf6866

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

README.md

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This project aims to replace PHP with Javascript in WordPress development by using Node.js and Express to consume data from a WordPress database using GraphQL. It uses [Apollo](http://apollostack.com) to fetch the data and deliver it into React components. **This repo is the codebase for [wordexpress.io](http://wordexpress.io), where I will write articles and documentation explaining how it works**.
44

5-
The core of this project revolves around setting up a connection to a WordPress database using Sequelize, defining models from that connection, and then querying those models using GraphQL. It's delivered through an npm package called WordExpress Schema. [Read the documentation](https://github.com/ramsaylanier/wordexpress-schema) for implementation details and information on how to extend it.
5+
The core of this project revolves around setting up a connection to a WordPress database using Sequelize, defining models from that connection, and then querying those models using GraphQL. It's delivered through an npm package called WordExpress Schema. [Read the documentation](https://github.com/ramsaylanier/wordexpress-schema) for implementation details and information on how to extend it.
66

77
I've also started creating a set of [WordExpress Components](https://github.com/ramsaylanier/WordExpressComponents) that contain GraphQL qeuries based on the WordExpress Schema package. Refer to that repo for documentation.
88

@@ -35,34 +35,6 @@ This project uses Amazon AWS with an S3 bucket. If you are hosting your media fi
3535
#### Database Settings
3636
This should be pretty self-explanatory: simply enter in the name of your database, username and password, and host. Make sure these are inside of "private", or else they'll be available on the client (WHICH IS BAD).
3737

38-
## Setting the Front Page
39-
When you run `npm startdev` for the first time, you'll probably get an error saying "cannot find page-title of undefined." This is probably because you haven't set a landing page in WordPress. By default, the [FrontPageLayout](https://github.com/ramsaylanier/WordPressExpress/blob/master/app/components/layouts/FrontPageLayout.js) component queries a post with the post-name (AKA slug) of "homepage". If you are using a fresh WordPress installation, simply create a page and give it a slug of "homepage." If you are working with an existing WordPress database, you can change which page that gets loaded by changing the page query in the `FrontPageLayout` component. See below:
40-
41-
```es6
42-
const FrontPageWithData = connect({
43-
mapQueriesToProps({ ownProps, state}) {
44-
return {
45-
page: {
46-
query: `
47-
query getPage{
48-
viewer{
49-
page(post_name: "homepage"){
50-
id,
51-
post_title
52-
post_content
53-
thumbnail
54-
}
55-
}
56-
}
57-
`
58-
}
59-
}
60-
}
61-
})(FrontPageLayout);
62-
```
63-
64-
Simply change "homepage" to anything you want. Keep in mind that it queries the post-name (AKA slug), not the post-title.
65-
6638
## Using React Components as Layouts
6739

6840
As mentioned above, make sure you have first installed the [WordExpress Companion Plugin](https://github.com/ramsaylanier/WordExpress-Plugin) into your WordPress plugins directory. The plugin will add a custom WordPress meta box to all your WordPress pages. There is a text input field in the meta box called `Page Layout Component`. The value you put in there should match one of the objects in the `Layouts` object in the [layouts directory](https://github.com/ramsaylanier/WordpressExpress/blob/master/app/components/layouts/layouts.js). The `Layouts` object stores some basic parameters that the `WordpressPage` component will read. It looks like this:
@@ -104,4 +76,4 @@ This project started out as just an experiment, but it seems like a lot of other
10476

10577
3) Work on developing more complex queries. The WordExpressDatabase object is currently expandable, meaning after importing the default from `wordexpress-schema` you can add Sequel models and queries to it before passing it into WordExpressGraphQLSchema. However, WordExpressGraphQLSchema is **not** expandable. This should be a thing.
10678

107-
4) ~~Figuring out how to get WordPress shortcodes to work. I'd only expect that built in WordPress shortcodes would work (i.e `[caption]`, but they don't currently. It would require parsing the post_content field and then recognizing short codes and then probably building a unique React component for each shortcode.~~ Currently only a few shortcodes work. I've got Caption working, as well as the ability to embed Github Gists.
79+
4) ~~Figuring out how to get WordPress shortcodes to work. I'd only expect that built in WordPress shortcodes would work (i.e `[caption]`, but they don't currently. It would require parsing the post_content field and then recognizing short codes and then probably building a unique React component for each shortcode.~~ Currently only a few shortcodes work. I've got Caption working, as well as the ability to embed Github Gists.

0 commit comments

Comments
 (0)