---
title: "Custom Plugin in Joomla"  
description: "A plugin is a kind of Joomla extension. Plugins provide functions which are associated with trigger events. Joomla provides a set of core plugin event"  
author: "Anonymous User"  
published: 2012-03-07  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/888/custom-plugin-in-joomla  
category: "joomla"  
tags: ["joomla"]  
reading_time: 3 minutes  

---

# Custom Plugin in Joomla

A plugin is a kind of Joomla [extension](https://www.mindstick.com/articles/22/extension-method). Plugins provide [functions](https://www.mindstick.com/forum/34086/jquery-callback-functions) which are associated with trigger events. Joomla provides a set of core plugin events, but any extension can fire (custom [extensions](https://www.mindstick.com/articles/12362/is-ajax-cart-extensions-necessary-for-e-commerce-websites)) events. When a particular event occurs, all plugin functions of the type associated with the event are executed in sequence. This is a powerful way of extending the [functionality](https://www.mindstick.com/blog/136/using-watermark-functionality-in-textbox-by-jquery) of the Joomla software. It also offers [developers](https://yourviews.mindstick.com/view/88480/why-developers-combine-multiple-ai-tools-instead-of-one) a way to extend the functionality of joomla [content management system](https://www.mindstick.com/blog/12586/list-of-the-five-best-content-management-systems-in-2019).\

The Plug-in Manager allows you to [enable and disable](https://answers.mindstick.com/qa/95974/how-can-i-enable-and-disable-the-exit-new-feature-of-microsoft-edge) Joomla plug-ins and to edit a plug-ins details and options. It is also useful for quickly enabling/disabling multiple plug-INS at once.

To open the plugin manager in joomla, first of all login in **Joomla Administrator Panel** backend and go to **Extensions -> Plugin Manager**

![Custom Plugin in Joomla](https://www.mindstick.com/mindstickarticle/490949d5-b87f-4772-9e3a-545e3f09cf2d/images/63d2c15c-ab9e-4801-8dd0-7c32b40dbacc.png)

Now, you will see a list of plugin which is provided by joomla by default. If you want to use these plugins, you have to select a plugin and click on ‘Enable’ button. But in any case if you want to use your own custom plugin then you have to follow the following step:

1. Create Plugin file

2. Upload zip file of recently created plugin file

##### How to create plugin file:

To create plugin file, first of all create two file first one is PHP (.php) and second one is XML file (.xml).

Here I’m creating two file with name **‘MyPlugin.php’** and **‘MyPlugin.xml’**. This plugin will helped in adding site style sheet. Let’s take a look on it.

##### ‘MyPlugin.php’ Code:

```
 <?php/***
@version   1.0*
@author    Arun Kumar Singh http://mindstick.com* @copyright Copyright
(C) 2010 MindStick Software Pvt. Ltd. */ // no direct accessdefined('_JEXEC') or die('Restricted index access'); jimport('joomla.plugin.plugin'); class plgSystemMyPlugin
extends JPlugin {   public function onAfterInitialise() { $app =& JFactory::getApplication();$doc =& JFactory::getDocument(); if ($app->isAdmin())
{// we are in the administrator$doc->addStyleDeclaration(
$this->params->get('admincss',''));} else {// we are in the frontend site     $doc->addStyleDeclaration(
$this->params->get('sitecss',''));}}}
```

##### ‘MyPlugin.xml’ Code:

```
<?xml
version="1.0" encoding="utf-8"?><extension
version="1.7.0" type="plugin" group="system"
method="upgrade"><name>System -
MyPlugin</name><creationDate>January
28, 2012</creationDate><author>Arun Kumar Singh</author><authorUrl>http://mindstick.com</authorUrl><copyright>Copyright 2010 mindstick</copyright><license>GNU/GPL</license><version>2.0</version><description>Allows
the addition of custom CSS to your site</description><files><filename
plugin="MyPlugin">MyPlugin.php</filename></files><config><fields
name="params"><fieldset
name="basic"><field
name="sitecss" type="textarea" width = "500"
height ="1000"  label="Site CSS"
description="The custom CSS to be added to the Site" /> </fieldset></fields></config></extension>
```

Now putting these files into **‘MyPlugin’** directory and create its zip file.

![Custom Plugin in Joomla](https://www.mindstick.com/mindstickarticle/490949d5-b87f-4772-9e3a-545e3f09cf2d/images/7f80c16f-d381-4610-9daf-0b76fe52b529.png)

##### Upload plugin zip file in Joomla:

To upload zip file in joomla, first of all login in **Joomla Administrator Panel** and go to **Extensions -> Extension Manager**.

![Custom Plugin in Joomla](https://www.mindstick.com/mindstickarticle/490949d5-b87f-4772-9e3a-545e3f09cf2d/images/44872918-5684-4b17-a3a2-3be3e0341bed.png)

Now browse your zip file and click on **‘Upload & Install’** button.

![Custom Plugin in Joomla](https://www.mindstick.com/mindstickarticle/490949d5-b87f-4772-9e3a-545e3f09cf2d/images/01f0bb2f-1406-4aa1-b2e6-6c742ba41d32.png)

Now go to **Extensions -> Plugin Manager.**

![Custom Plugin in Joomla](https://www.mindstick.com/mindstickarticle/490949d5-b87f-4772-9e3a-545e3f09cf2d/images/63480391-1813-4442-8c41-53acb72fc416.png)

Now select your uploaded plugin and click **‘Enable’** button.

![Custom Plugin in Joomla](https://www.mindstick.com/mindstickarticle/490949d5-b87f-4772-9e3a-545e3f09cf2d/images/e88e1889-7eb2-47bb-b830-e8f4b1e8a514.png)

Now click on **Extensions -> Plugin Manager**.

![Custom Plugin in Joomla](https://www.mindstick.com/mindstickarticle/490949d5-b87f-4772-9e3a-545e3f09cf2d/images/34ab5427-2827-4c2f-bb30-827ae73024a9.png)

Now, click on **‘Save & Close’** button and click ‘View Site’ which is at top right in panel.

![Custom Plugin in Joomla](https://www.mindstick.com/mindstickarticle/490949d5-b87f-4772-9e3a-545e3f09cf2d/images/1710dbc3-d860-4c2b-a4ac-cd737fb12976.png)

![Custom Plugin in Joomla](https://www.mindstick.com/mindstickarticle/490949d5-b87f-4772-9e3a-545e3f09cf2d/images/33959630-5d73-4c91-9cc0-7589044d3f13.png)

\

---

Original Source: https://www.mindstick.com/articles/888/custom-plugin-in-joomla

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
