WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
WPDK How-tos

Here you can find a set of examples and how-tos about WPDK in action into a WordPress environment.

Any example and/or how-to is available to anyone through GitHub interface. If you want to download and use these examples in your environment, you naturally have to install WPDK first: please follow these rules to do that.

  • Hello World! WordPress plugin using WPDK - the basic - click here
  • Hello World! WordPress plugin using WPDK - intermediate - click here
  • Sample #1 of WordPress plugin using WPDK - two submenu item connected to simple view-controllers - click here
  • Sample #2 of WordPress plugin using WPDK - shows all available WPDK graphic controls - click here
  • Sample #3 of WordPress plugin using WPDK - two submenu item connected to specialized view-controllers - example of plugin configuration handling -click here

Hello World! WordPress plugin using WPDK - the basic

This how-to creates a simple WordPress plugin and generates, through WPDK object WPDKMenu, an Hello World! menu item in the administration area of your WordPress environment. This code is very simple, and shows a basic, not invasive way of using WPDK in developing a WordPress plugin.

Please follow these instructions to see this how-to in action in your WordPress environment.

  1. If not already done, install WPDK in your environment - please follow these rules to do that.
  2. Download the zip of this how-to from official GitHub repository clicking here.
  3. Unzip this how-to. You will have its root directory named wpdk-sample-menu-1-master
  4. Copy the entire wpdk-sample-menu-1-master folder in the wp-content/plugins directory of your WordPress environment.
  5. Activate the plugin in your WordPress administration area: a new Hello World! menu item will appear in the main navigation menu at the left side of the screen.
  6. The source code of this plugin is well documented, and can be an easy starting point for your develop with WPDK.

Hello World! WordPress plugin using WPDK - intermediate

This how-to creates a simple WordPress plugin and generates, through WPDK object WPDKMenu, an Hello World! menu item in the administration area of your WordPress environment. This code is relatively more complex than first Hello World! example: the plugin menu is made of two submenu items, each one with its own function called whenever the item is clicked; and the main menu item has an attached icon, as other main menu item in WordPress menu of Administration Screen.

The plugin menu is built through another WPDK way of creating menu in Administration Screen: as an array, with specific array items, processed by renderByArray static method of WPDKMenu class. It is another powerful, readable and easy way to accomplish this task with WPDK.

Please follow these instructions to see this how-to in action in your WordPress environment.

  1. If not already done, install WPDK in your environment - please follow these rules to do that.
  2. Download the zip of this how-to from official GitHub repository clicking here.
  3. Unzip this how-to. You will have its root directory named wpdk-sample-menu-2-master
  4. Copy the entire wpdk-sample-menu-2-master folder in the wp-content/plugins directory of your WordPress environment.
  5. Activate the plugin in your WordPress administration area: a new Hello World! menu item will appear in the main navigation menu at the left side of the screen, with an icon at the left, and two related submenu items.
  6. The source code of this plugin is well documented, and can be an easy starting point for your develop with WPDK.

Sample #1 of WordPress plugin using WPDK

This how-to is the first basic sample of a WordPress plugin developed using WPDK: a little more complex sample than #1 and #2 above.

This is the structure:

  • Create a main menu with two submenu items, through methods addSubMenu and render of WPDKMenu class.
  • Connect each submenu item to a specific specialized WPDKViewController class instance. These specialized instances handle the HTML output shown in the work area of WordPress Administration Screen, and their source code is in plugin_root_dir/classes/wpdk-sample-vc.php file.
  • Customize method display of any specialized WPDKViewController class instance, in order to show my own content whenever the related submenu item is clicked.

Please follow these instructions to see this how-to in action in your WordPress environment.

  1. If not already done, install WPDK in your environment - please follow these rules to do that.
  2. Download the zip of this how-to from official GitHub repository clicking here.
  3. Unzip this how-to. You will have its root directory named wpdk-sample-plugin-1-master
  4. Copy the entire wpdk-sample-plugin-1-master folder in the wp-content/plugins directory of your WordPress environment.
  5. Activate the plugin in your WordPress administration area: a new WPDK Plug#1 menu item will appear in the main navigation menu at the left side of the screen, with an icon at the left, and two related submenu items. Click them to see result.
  6. The source code of this plugin is well documented, and can be an easy starting point for your develop with WPDK.

Sample #2 of WordPress plugin using WPDK

This how-to is the second sample of a WordPress plugin developed using WPDK. This is the structure:

  • Create a main menu with two submenu items, through methods addSubMenu and render of WPDKMenu class.
  • The first submenu item is connected to a specific specialized WPDKViewController class instance. This specialized instance embeds a specific WPDKView class that shows all the available WPDK graphic controls you can easily use in your own code. Following this simple use case, you can easily build and customize the views that control all aspects and parameters of your WordPress creation. This sample doesn't store user choices in a custom configuration: it is only a container of all available WPDK graphic controls. Next how-to will show you how to save and reload your own preferences using the same internal architecture.

Please follow these instructions to see this how-to in action in your WordPress environment.

  1. If not already done, install WPDK in your environment - please follow these rules to do that.
  2. Download the zip of this how-to from official GitHub repository clicking here.
  3. Unzip this how-to. You will have its root directory named wpdk-sample-plugin-2-master
  4. Copy the entire wpdk-sample-plugin-2-master folder in the wp-content/plugins directory of your WordPress environment.
  5. Activate the plugin in your WordPress administration area: a new WPDK Plug#2 menu item will appear in the main navigation menu at the left side of the screen, with an icon at the left, and two related submenu items. Click them to see result.
  6. The source code of this plugin is well documented, and can be an easy starting point for your develop with WPDK.

Sample #3 of WordPress plugin using WPDK

This how-to is the third sample of a WordPress plugin developed using WPDK. This is the structure:

  • Create a main menu with two submenu items, through methods addSubMenu and render of WPDKMenu class.
  • The first submenu item is connected to a specific specialized WPDKViewController class instance. This specialized instance embeds a specific WPDKConfigurationView class called ControlsConfigurationView, that shows a little subset of WPDK graphic controls driving plugin configuration. You can set values and store them into DB, clicking the Update button; or you can restore values to their default, clicking the Reset to default button. Following this simple use case, you can easily build and customize your own plugin configuration, creating a property into ControlsSettings model, and setting its value with a specific WPDK graphic control defined into the ControlsConfigurationView specialized view.
  • updatePostData method of ControlsConfigurationView class processes the Update request incoming from related button in the view.
  • resetToDefault method of ControlsConfigurationView class processes the Reset to default request incoming from related button in the view.

Please follow these instructions to see this how-to in action in your WordPress environment.

  1. If not already done, install WPDK in your environment - please follow these rules to do that.
  2. Download the zip of this how-to from official GitHub repository clicking here.
  3. Unzip this how-to. You will have its root directory named wpdk-sample-plugin-3-master
  4. Copy the entire wpdk-sample-plugin-3-master folder in the wp-content/plugins directory of your WordPress environment.
  5. Activate the plugin in your WordPress administration area: a new WPDK Plug#3 menu item will appear in the main navigation menu at the left side of the screen, with an icon at the left, and two related submenu items. Click them to see result.
  6. The source code of this plugin is well documented, and can be an easy starting point for your develop with WPDK.