PMPro React Demo
Starter WP Plugin built with React
by Peter Tasker & pbrocks · github.com/pbrocks/pmpro-react-demo · website
★ 1stars
1forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/pbrocks/pmpro-react-demo/archive/refs/heads/master.zipPMPro React Demo
Sample WordPress plugin for setting up a project with Yarn, Webpack, BrowserSync and React. Tailored to creating a wp-admin page, but completely flexible and can be used for themes as well.
Companion blog post: https://deliciousbrains.com/develop-wordpress-plugin-webpack-3-react/
Getting started
- Fork repo to your Github account
- Clone repo to your
wp-content/pluginsfolder - In
config.jsonchange theproxyURLto match the admin url of the plugin page,http://pmpro.local/wp-admin/index.php?page=pmpro-react-demo. - In your host WordPress
wp-config.phpfile adddefine( 'PMPRO_AJAX_BASE', 'http://pmpro.local/wp-json/pmpro/v1' );and update it to point to your REST API base - Modify any WordPress config in
pmpro-react-demo.php. Rename files/methods/strings as necessary. - Activate the plugin in wp-admin
- Navigate to the the admin url of the plugin page,
http://pmpro.local/wp-admin/index.php?page=pmpro-react-demo. - The page should be blank.
- Open Terminal.
cdinto your plugin's folder and runyarn- Run
yarn startto get Webpack and BrowserSync running - A proxy window should open your plugin page,
http://pmpro.local/wp-admin/index.php?page=pmpro-react-demo, athttp://localhose:3000/wp-admin/index.php?page=pmpro-react-demo, and you should see your WP Options in an editable table.
To build for production run:
yarn build
A production-ready WordPress plugin will be built in the pmpro-react-demo-built folder.