/ai-for-wp

Primary LanguagePHPGNU General Public License v2.0GPL-2.0

image

Modern Settings Page Boilerplate for WordPress

Motivation

Creating the boilerplate of plugin or theme settings page using WordPress packages and make UI and UX close to WordPress and Gutenberg backend.

What's inside

  • πŸ€ΉπŸ»β€Š Keep as simple as possible

  • πŸ‘₯β€Š Close design and UX to WordPress and Gutenberg

    • πŸ₯žβ€Š Components from @wordpress/components.
  • πŸͺΆβ€Š Lightweght assets

    • Using wp-scripts package with WebPack underhood to build bundle with minification on production mode
    • Loads embedded to WordPress React, @wordpress/components libraries and jQuery without including to final bundle
    • jQuery to perform ajax requests - we can use any package, but we already have it on backend.
    • Using @wordpress/i18n for i18n capatible translations.
  • πŸ§‘β€πŸŽ¨β€Š PostCSS with stage-0 features to use any CSS-next features

  • βš‘β€Š Great developer experience

    • πŸš€ Supports React Hot Module Reload to refresh components without reloading the page.
  • β˜„οΈ Effector state manager - it's effective state manager without big boilerplate of code and clean

  • Notifications

  • Form Examples

    • Simple form - form with couple fields.
    • Repeatble form
  • πŸ”¬β€Š Coding standarts

    • Phpcs and wp-coding-standards is available
    • Prettier is used to format js, css files
  • πŸŒβ€Š Translation Ready

    • πŸ“β€Š Use @wordpress/i18n and __();
    • πŸ“₯β€Š Generate pot and json files for translation

How to try on my WordPress site? πŸ€”β€Š

Clone the repo using next command to your wp-content/plugins/ directory:

git clone https://github.com/fnpen/wp-modern-settings-page-boilerplate.git

Enable plugin 'Modern Settings Page Boilerplate for WordPress' and click to 'Modern Settings' menu item.

More Examples

image

How to modify and build bundle? πŸ˜Žβ€Š

Install nodejs and npm to your system,

Install all packages :

npm install

// if you use pnpm:

pnpm i

Use the next command to build the bundle in development mode:

npm run start

πŸ₯³β€Š

Have a great time with developing!

The bundle will be rebuilt on any file change.

Use the next command to build the bundle in production mode:

npm build

Using Hot Module Reload mode πŸ€”β€Š

Install mkcert on your system using the next manual: https://github.com/FiloSottile/mkcert

Register this root certificate:

mkcert -install

Generate certificate for localhost:

mkcert localhost 127.0.0.1 ::1

The last command will create two files: "./localhost+2.pem" and "./localhost+2-key.pem"

Rename file .env.example to .env and paste the next content:

TSL_KEY='FULL_PATH_TO_FOLDER/.mkcert/localhost+2-key.pem'
TSL_CERT='FULL_PATH_TO_FOLDER/.mkcert/localhost+2.pem'

Replace FULL_PATH_TO_FOLDER with path to folder with created certificated.

Run wp-script in "hot" mode and refresh page:

npm run hot

Now you can try edit js files and the dev server reflects changes to page.