How to create content plugin for Joomla 2.5.x

In this first article of our tutorial series on how to create a Joomla 2.5 Content plugin, we will give you the source code for our Hello World plugin. This plugin will print “Hello World!” at the beginning of every article. As we dive further into more tutorials, we’ll provide more details on what all of this code means. For now we will show you how to create the plugin, how to install the plugin, and then what it does.

How to create a Hello World content plugin for Joomla 2.5

All Joomla 2.5 plugins contain a xml file. These xml files contain information such as who wrote the plugin and when, what files should be included with the plugin, and any plugin settings that can be adjusted. The first thing you should do is copy the following text and save it as helloworld.xml

<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="content">
<author>Brad Markle</author>
<creationDate>June 18th, 2012</creationDate>
<copyright>InMotion Hosting</copyright>
<license>GNU General Public License</license>
<description>Simple Hello World Plugin that prints "Hello World" at the beginning of every article.</description>
<filename plugin="helloworld">helloworld.php</filename>

After creating the XML file, we now need to create our php file, which does all of the work. The following code should be saved to helloworld.php


// no direct access
defined('_JEXEC') or die;

class plgContentHelloworld extends JPlugin
public function onContentAfterTitle($context, &$article, &$params, $limitstart)
return "<p>Hello World!</p>";


The last file we need to create is one named index.html. You don't need to place any code in the file, you simply need to create it.

At this stage, you should have the following files:


Compress all of these files into a zip file named
Be Sociable, Share!

Leave a comment