How to write a plugin

13 Jul 2015
@PHPVibe
5109
1

plugins

The PHPVibe plugins system is fairly simple to use and code for.
It relies on the hooks and filters present in PHPVibe (very similar to WordPress’s system).

The plugin needs to have it’s own folder name and contain the file plugin.php, it needs to be activated through the ‘Plugins’ menu in the administration area.

A simple plugin example adding a message at the start of your homepage.

Create /plugins/hello/plugin.php

Top of file (plugin details, commented):


Create the function returning the message.
In the simplest form ever you can use the language system to modify and translate the message.

function HelloWorld(){
echo _lang("Welcome to my great website");
}

Now we hook the function to the 'home-start' action present on top of home.php

add_action('home-start', 'HelloWorld');

Sure, you can use very complex logic and code here and on all the other actions, this is just a very simple example.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *