---
title: "How to create a Hello World content plugin for Joomla 2.5"
description: "Joomla 2.5 has reached its end of life as for 12/31/2014. Please be advised this may be a security risk to your website. You can view more information about the end of life here. In this first..."
url: https://www.inmotionhosting.com/support/edu/joomla/joomla-2-5/hello-world/
date: 2012-06-19
modified: 2021-08-16
author: "Brad Markle"
categories: ["Joomla", "Joomla 2.5"]
tags: ["Joomla v2.5"]
type: post
lang: en
---

# How to create a Hello World content plugin for Joomla 2.5

Joomla 2.5 has reached its end of life as for 12/31/2014. Please be advised this may be a security risk to your website. You can view more information about the end of life [here](https://docs.joomla.org/Joomla!_CMS_versions).

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.

## Step 1: Create the Plugin Files

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">
<name>plg_content_helloworld</name>
<author>Brad Markle</author>
<creationDate>June 18th, 2012</creationDate>
<copyright>InMotion Hosting</copyright>
<license>GNU General Public License</license>
<authorEmail>bradm@inmotionhosting.com</authorEmail>
<authorUrl>https://www.inmotionhosting.com</authorUrl>
<version>1.0</version>
<description>Simple Hello World Plugin that prints "Hello World" at the beginning of every article.</description>
<files>
<filename plugin="helloworld">helloworld.php</filename>
<filename>index.html</filename>
</files>
</extension>
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**

<?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**:

- helloworld.xml
- helloworld.php
- index.html

**Compress** all of these files into a zip file named **helloworld.zip**

**Important!** Keep in mind that Linux servers are case sensitive and *helloworld.php* is not the same as *HelloWorld.php* and so forth.

## Step 2: Install the Plugin

Installing this plugin is like installing any other plugin. If you need any additional help, please see our article on [how to install a Joomla 2.5 plugin](/support/edu/joomla/joomla-2-5/how-to-install-a-plugin/).

## Step 3: Enable and Test your new Plugin

When you initially install the plugin, it will be disabled, so be sure to **enable the plugin**.

[![hello-world-plugin-in-action](https://www.inmotionhosting.com/support/wp-content/uploads/2012/06/edu_joomla25_create-plugin-tutorial_hello-world-plugin-in-action.gif)](/support/wp-content/uploads/2012/06/edu_joomla25_create-plugin-tutorial_hello-world-plugin-in-action.gif)

Visit any Joomla 2.5 article, and you should see “Hello World!” printed after the title, as in the following screenshot to the right.

Because we used the **onContentAfterTitle event**, our “Hello World” message is being shown *on the content* and *after the title has been printed*.

[![hide-show-intro-text](https://www.inmotionhosting.com/support/wp-content/uploads/2012/06/edu_joomla25_create-plugin-tutorial_hide-show-intro-text.gif)](/support/wp-content/uploads/2012/06/edu_joomla25_create-plugin-tutorial_hide-show-intro-text.gif)

**Please Note**!

In order for this particular plugin to work, one more thing must be done. Because we’re using the **onContentAfterTitle** event, we need to set the article’s **Show Intro Text** value to **Hide**:
