Gantry is a powerful framework, or set of building blocks for which to build simple or complex websites. Find out more...

Adding Widget Positions

This section covers how to add a new widget position to the Gantry Framework, and to your Gantry-enabled template.

Check out this quick screencast on Widget Positions to get an overview of how widget positions work within WordPress and the Gantry Framework.

Step 1: Getting Ready

Determine the position name and location on your theme where you would like your new position to appear. In our example, we will use "Example."

Step 2: Adding Position to index.php

Open your template index.php file and go to where you would like to add your new position. Using $gantry, we will make a call to the object using the function: displayModules(positionname, widgetlayouttype, widgetchromelayout);. This call will need to be echoed.

Example:

<div id="rt-exampleposition">
  <?php echo $gantry->displayModules('example','standard','standard'); ?>
  <div class="clear"></div>
</div>

The new position now will appear after we have configured the Gantry portion to recognize it. Until then, it will not work properly.

Step 3: Adding Position to Gantry Framework

Open templateDetails.xml and scroll down to the "positions" tag where the default Gantry positions are listed. Under here, we will need to add our "row module" positions a through f.

Example:

<position id="example" name="Example" max_positions="6">Example</position>

Next: Scroll down to the line which says:

<fieldset name="layouts" label="LAYOUTS">

This is where we add our new position layout slider. We need to add the following XML block to make this appear in Template Settings:

<fields name="example" type="position" label="Example" description="LAYOUT_POS_DESC">
    <field name="layout" type="positions" default="3,3,3,3" label="">
        <schemas>1,2,3,4,5,6</schemas>
        <words>2,3,4,5,6,7,8,9,10</words>
    </field>
    <field name="showall" type="toggle" default="0" label="FORCE_POS"/>
    <field name="showmax" type="showmax" default="6" label="POS_COUNT"/>
</fields>
Attribute Description
name Name of position
type Must always be "position"
default Default layout for the widget position any combination of 12 separated by commas.
label Label in Template Settings for this position.
description Description of what this area is used for.

Found errors? Think you can improve this documentation? Please edit this page. You can also view the history of this page.