React WP Shortcode Boilerplate is a foundational WordPress plugin designed to jumpstart your project. It enables easy integration and rendering of a React application within any post or page through a straightforward shortcode. Built on @wordpress/scripts, it offers a streamlined development and build workflow perfect for custom projects.
Ensure you have Node.js
and npm
installed on your machine.
-
Download the Plugin: Download the ZIP file of this plugin and extract it to your WordPress plugin directory (
wp-content/plugins/react-wp-shortcode
). -
Install Dependencies: Navigate to the plugin's root directory in a terminal and run
npm install
to install the required dependencies. -
Build for Production: Run
npm run build
to compile and optimize your React app for production use. -
Activate the Plugin: Navigate to the "Plugins" menu in your WordPress admin area. Find "React WP Shortcode" in the list and click "Activate".
To use the plugin, simply add the following shortcode to the content of any post or page where you want your React app to appear:
[react_wp_shortcode_app]
Or you can optionally specify an ID attribute for the root element of your React app:
[react_wp_shortcode_app id="my-react-app"]
Ensure you have Node.js
and npm
installed on your development machine.
-
Clone the Plugin: Clone this repository into your WordPress plugin directory.
-
Install Dependencies: Navigate to the plugin's root directory in a terminal and run
npm install
to install the required dependencies. -
Start Development: Run
npm start
to start the development server. This command watches for any changes in yoursrc
directory and automatically rebuilds your app. -
Build for Production: Run
npm run build
to compile and optimize your React app for production use.
- Simple shortcode integration.
- React app rendering within WordPress content.
- Easy to customize and extend.
You can customize the React app by editing the files in the src
folder. After making changes, remember to run npm run build
to compile your changes.