Member-only story

How to Use Twig, ReactJS, and Bootstrap 5 in a WordPress plugin

Mark Caggiano
3 min readMar 9, 2023

--

To use Twig, ReactJS, and Bootstrap 5 in a WordPress plugin for both admin panel and user, follow these steps:

Set up a WordPress development environment

  • Install WordPress on your local machine using a web server such as Apache or Nginx.
  • Create a plugin folder in the WordPress plugins directory and name it accordingly.

Install necessary packages

In the root directory of your plugin, run the following command in your terminal to install necessary packages:

npm init

Then install the following packages:

npm install react react-dom @babel/core @babel/preset-react babel-loader bootstrap axios webpack webpack-cli webpack-dev-server twig

Create the basic plugin structure

In your plugin folder, create a file named index.php and add the following code:

<?php
/*
Plugin Name: My Plugin
Description: My Plugin Description
Version: 1.0
Author: My Name
*/

Then create a folder named “src” in your plugin folder.

--

--

Mark Caggiano
Mark Caggiano

Written by Mark Caggiano

Internet Marketer, Web Developer, Traveler

No responses yet