Documentation
Theme
The theme plugin gives you access to theme assets and partials. It a critical and extremely useful plugin for building your sites with PyroCMS.
The theme plugin's slug is theme, so it can be used like so:
{pyro:theme:function}
Functions
{pyro:theme:options}
Displays an option for the current theme. To read more about this tag and its usage refer to the theme documentation.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| option | None | Yes | The option slug to request from the theme. |
Example:
{if '{pyro:theme:options option="layout"}' == 'full-width'}
<div class="full-width">
{pyro:template:body}
</div>
{/if}
{pyro:theme:partial}
Loads partial from the current theme.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| name | None | Yes | Name slug of the theme to be loaded. |
Example:
{pyro:theme:partial name="header"}
{pyro:theme:css}
Generates a <link> to a css file in the current theme.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| file | None | Yes | Name of the css file. |
| misc | None | No | This function will take any other link tag attributes and pass them along to the link tag. By default, 'type' and 'rel' are included with default values. |
Example:
{pyro:theme:css file="style.css"}
<link href="themes/default/css/style.css" type="text/css" rel="stylesheet" />
{pyro:theme:image}
Generates an <img> tag for an file in the current theme.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| file | None | Yes | The name of the image file. |
| misc | None | No | This function will take any other image tag attributes and pass them along to the image tag. |
Example:
{pyro:theme:image file="fun.jpg" alt="Fun!"}
<img href="themes/default/img/fun.jpg" alt="Fun!" />
{pyro:theme:js}
Generates a <js> script link for a javascript file in the current theme.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| file | None | Yes | The name of the javascript file. |
Example:
{pyro:theme:js file="extra.js"}
<script type="text/javascript" src="themes/default/js/extra.js">
{pyro:theme:favicon}
Generates a <link> tag for a favicon file in the current theme.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| file | favicon.ico | No | Favicon file. |
| rel | shortcut icon | No | Favicon rel. |
| type | image/x-icon | No | Favicon type. |
| xhtml | true | No | Build a W3C valid link tag xhtml? enter false if you uses html5. |
| base | path | No | "path" or "url". |
Example:
{pyro:theme:favicon file="favicon.png"}
<link href="/system/pyrocms/themes/default/img/favicon.png" rel="shortcut icon" type="imagem/x-icon">
{pyro:theme:variables}
Sets or retrieves a variable for the theme of your choosing. Variables can be set in a layout and be used anywhere thereafter.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| name | None | Yes | The name of the variable. |
| value | None | No | Value for the variable to be set. Leave blank to retrieve a previously set variable. |
Example (Variable Setting - nothing displayed):
{pyro:theme:variables name="day_or_night" value="day"}
Example (Variable Retrieval):
{pyro:theme:variables name="day_or_night"}
day
