# Upgrading legacy themes

{% hint style="danger" %}
**Please note:** This page is under construction and has not been finished yet.
{% endhint %}

## Introduction

Themes developed for v1.x of e107 will continue to work using v2.x. However, to get the most out of v2.x, it is recommended to make the following changes to bring your theme up to date with the new v2.x standards.

## theme.php

* Replace **$HEADER** and **$FOOTER** with **$HEADER\['default']** and **$FOOTER\['default']**
* Replace any occurrences of **$CUSTOMHEADER** and **$CUSTOMFOOTER** with **$HEADER\['custom']** and **$FOOTER\['custom']**
* If your theme contains links to external social media pages such as Facebook, Twitter or YouTube, use the core definitions for them. ie. **XURL\_FACEBOOK**, **XURL\_TWITTER**, **XURL\_YOUTUBE.**&#x20;
* Remove any reference to **$CUSTOMPAGES** and place them inside [**theme.xml**](/theme-development/installation-and-configuration.md#theme-xml) in the [layouts](/theme-development/installation-and-configuration.md#layout-section) section.&#x20;

```markup
<layout name='custom' title='Custom Pages'>
	<custompages>FRONTPAGE</custompages>
	<custompages>/forum/</custompages>
</layout>
```

* If you have used index.php in your **$CUSTOMPAGES** list, use **FRONTPAGE** instead (see above)
* The function **theme\_head()** has been deprecated. Instead, use either [e107::css()](/classes-and-methods/css.md) or [e107::js()](/classes-and-methods/javascript.md) to include what you require in the header. (see bootstrap or other new core theme for examples)
* **Shortcodes** need to be set to **UPPERCASE** in all occurrences in your [theme.php](/theme-development/layout-and-templates.md#theme-php) file. (`$register[]` and everywhere else in [theme.php](/theme-development/layout-and-templates.md#theme-php))

## Theme shortcodes

{% hint style="info" %}
**TIP:** As of e107 v2.x, you no longer need separate `xxxxxx.sc` files inside your theme's folder. You can now include all your theme-specific shortcodes in a single file called[**`theme_shortcodes.php`**](/theme-development/theme-shortcodes.md#theme_shortcodes-php).&#x20;
{% endhint %}

Read more on theme shortcodes here:

{% content-ref url="/pages/-MUSuibkooxVi6EbjZsQ" %}
[Theme Shortcodes](/theme-development/theme-shortcodes.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devguide.e107.org/theme-development/upgrading-legacy-themes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
