Introduction

Recently I was asked to show an easy way of building pods UI plugin which is a bit less advanced that the one described in previous tutorial: building pods framework UI plugin – basic setup.

Additionally one of the readers asked me to show an easy example of a post-save hook which sends an email after data is saved. I will try to incorporate that too.

Preparation

1. Knowledge:

a) WordPress as a software is available for us for many years. That’s why it’s almost impossible to know everything about each function or class along with its parameters. If you don’t know what particular function does, what parameters it accepts then WordPress Codex is a page which you have to bookmark (I’m visiting it many times per day too).

b) Pods Framework documentation page – Scott makes a great job to update it whenever he has a moment during development job.

c) My previous tutorials on PodsFramework

2. Tools:

a) PodsFramework plugin – currently version 2.2

b) Slightly modified package from my last tutorial (only author -> book setup). Please import it using import function in PodsAdmin area. Download package here

Let’s start

This time we will build simple one-file plugin which will do the job. The plan is very simple and can be described in few points:

  • create plugin,
  • remove obsolete ‘pods” menu from sidebar (because we want to use our functionality and not confuse users with 2 menu items managing same thing),
  • add new menu object with its 3 submenu items (general information, authors management, books management)
  • add post_save helper which will send an email each time new book is added to the system.

The same as in previous tutorial – WordPress Codex –http://codex.wordpress.org/Writing_a_Plugin is your reference which you should read in case you need any more explanation of how to build WP plugin.

Please create  /wp-content/plugins/lg-pods-plugin/ and create an index.php file in there:

And that’s all folks 😉 – please read the code carefully because I have added a lot of comments (especially to inform_my_friends() function) which should help you understand how everything works.

Please leave a comment below if something is unclear or even if you want just to say “hi”.

Related posts

Posted by Kamil Grzegorczyk Owner / Development