• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Creating a Template Based Add-On

Creating a Template Based Add-On 1.0.0

No permission to download
Compatible XF 1.x versions
1.2, 1.3, 1.4, 1.5
If you need to edit a XenForo template, you can either edit the template directly or use the built-in template modification system. With the template modification system, you can package template modification(s) as an add-on, export it from the source forum and import it into different forums or share the template modifications with others.

This tutorial will go over how to package a template modification as an add-on and will use the template modification suggested by Syndol in this threadas an example.

The first thing that needs to be done is to set the forum in debug mode.

Open up “library\config.php” and add the following line of code and save the file.

$config['debug'] = true;

Now that the forum is in debug mode, you can create an add-on. Go to Home -> Add-ons and click on “Create Add-on”.

Fill in the following fields and click on Save Add-on.

Next, go to Appearance -> Template Modifications and click on “Create Template Modification”

Fill in all the required fields.

In the Find box enter
#{xen:calc '{$post.position} + 1'}
In the Replace box enter

#{xen:calc '{$post.position} + 1'}/{xen:calc '{$thread.reply_count} + 1'}

Click on “Test Modification” to validate that it works. You should see the following:

Click on “Save Template Modification”.

Next, got to Home -> Add-ons and export the add-on.

You can now import this add-on into another forum just like you import any other add-on.

The end result, which you can download here.

Additional Modifications

The following are examples of additional modifications that can be packaged into an add-on

Template Conditionals

In this example, a template conditional will be added around a block of code.

In the Find box, add the entire block of code that you want to surround with the template conditional.

In the Replace box, the content of the Find box can be referenced by the $0 variable. This makes it very convenient to add the conditional statement around the block of code.

This block of code will not be shown in forums with IDs of 3, 40 and 111.


You can add entries to EXTRA.CSS and package them as an add-on.

Set the Search Type to "Regular Expression"

In the Find box enter
In the Replace box enter
/* Enter CSS entries */


Custom phrases can packaged into an add-on and referenced in templates.

Create the new phrase.

Add it to a template.

End result
First release
Last update
5.00 star(s) 2 ratings

More resources from 0ptima

Latest reviews

Awesome step by step tutorial, that helps even those who didn't code yet to be bale to create an add-on. Clear enough. Hope to see more advanced tutorials (like add-ons with style properties options and ...).
Fantastic, This is what i am looking for :) since a while.