It's easy to think about just hacking a template to add some code to a website, but creating a module is easy enough, and much easier to maintain.
To illustrate how simple a module is:
For a plugin called 'simple':
To illustrate how simple a module is:
For a plugin called 'simple':
Create a directory called 'simple'.
File 1 is simple.php - contains the plugin info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{php} | |
<?php | |
//{plugin}_info | |
function simple_info() { | |
$module_info = array( | |
'name' => 'My Simple Demo Module', | |
'intro' => 'The Simplest Module', | |
'version' => '0.1', | |
'author' => 'grwebguy', | |
'website' => 'http://twitter.com/grwebguy', | |
'compatibility' => '4.7' | |
); | |
} | |
``` |
File 2 is simple.site.php contains the code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{php} | |
<?php | |
defined('IN_PLUCK') or exit('Access denied!'); | |
//{pluginname}_theme_main() | |
function simple_theme_main() { | |
echo getMessage(); | |
} | |
function getMessage() { | |
return 'Hello Friends, this is my simple module'; | |
} | |
``` |
No comments:
Post a Comment