Middleman WordPress Example
An example site illustrating how to integrate WordPress managed content into a statically generated Middleman site.
Specifically, this example illustrates how to pull posts from WordPress and paginate them. It also illustrates how to include content from additional sources. In this case, we create an about page from a markdown file.
- Install WordPress
- Setup pretty permalinks in the WordPress settings and update the .htaccess file
- Download and install the WP REST API plugin
- Activate the WP REST API plugin
- Confirm that it is working by visiting
If everything worked correctly, you will see an array of posts formatted as JSON.
This example illustrates how to fetch multiple pages of content and paginate it. For the best effect, you should enter more than 10 posts into your WordPress installation.
Install Middleman and Dependencies
- cd into this project directory
bundle installto install all dependencies
config.rband update this string
http://middleman-wordpress-example.dev/wp-json. It should point the your WordPress REST API. Do not include a trailing slash or any additional parameters.
- Activate and configure deploy if you plan to deploy this via rsync, ftp, sftp, or git. See the documentation.
Serve, Build, or Deploy
- To build and server the site on http://localhost:4567, run
- To build the site into the build directory, run
- To deploy the contents of the build directory, run
middleman deploy(only if you activated and configured deploy)