Skip to content

joshcummingsdesign/wp-plugin-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP Plugin Starter

semantic versioning

An opinionated fork of the WordPress Plugin Boilerplate.

Getting Started

  • Update the plugin info as seen below.

  • Create settings fields by adding to the array in the render method in admin/class-admin.php.

  • Get the data from your settings fields in the render method in frontend/class-frontend.php where it says controller.

  • Use that data in your default template found in frontend/partials/view.php.

  • Users will have the ability to create their own template in a folder called partials/plugin-name.php in their theme. All the variables you declare in the controller will be accessible to them.

  • Here is an example of how to make an AJAX call in the admin.

Update the Plugin Info

Change the following generic plugin info:

  • Namespaces in all PHP files - namespace PLUGIN_NAME;
  • ./plugin-name
  • plugin-name.php
  • class-info.php - SLUG, VERSION, OPTION_NAME, UPDATE_URL
  • Make sure the UPDATE_URL has a trailing slash at the end
  • frontend/class-frontend.php - assets method
  • fronend/js/plugin-name-frontend.js
  • fronend/css/plugin-name-frontend.css
  • admin/class-admin.php - assets method
  • admin/class-admin.php - text domain
  • admin/js/plugin-name-admin.js
  • admin/css/plugin-name-admin.css
  • uninstall.php - option names