Pockets: Adding Custom HTML and Javascript to Your Vanilla Forum

< 1 minute read

July 8, 2014

Pockets: Adding Custom HTML and Javascript to Your Vanilla Forum

&amp;amp;amp;lt;br /&amp;amp;amp;gt;

To make sure you don’t miss future videos, you can subscribe to our video channel here.

Below are some examples of the conditionals you can use with Pockets in your theme. Place the pocket name where ‘foo’ is in the below examples.

Adding a conditional so Pocket is only shown on Homepage (when Category is Default)
{if InSection("CategoryList")}
{pocket name="foo"}
{/if}

Adding a conditional so Pocket is only shown on the General Category
{if $Category.Name == "General"}
{pocket name="foo"}
{/if}

Adding a conditional so Pocket is only shown in categoryid 13
{if $Category.CategoryID == "13"}
{pocket name="foo"}
{/if}

Adding a conditional so Pocket is only shown in categoryid 1 & 13
{if $Category.CategoryID == “1”||$Category.CategoryID == “13”}
{pocket name=”foo”}
{/if}

Adding a conditional so Pocket is shown only on the Best of page
{if InSection ("BestOf")}
{pocket name="foo"}
{/if}

Adding a conditional so Pocket shown only on the Sign In page
{if InSection ("Entry")}
{pocket name="foo"}
{/if}

Adding a conditional so Pocket shown only to a user who is SignedIn
{if $User.SignedIn}
{pocket name="foo"}
{/if}

Adding a conditional so Pocket shown only to users not SignedIn
{if !$User.SignedIn}
{pocket name="foo"}
{/if}

Adding a conditional so Pocket is only shown to users with the ‘Garden.Settings.Manage’ permission
{if CheckPermission('Garden.Settings.Manage')}
{pocket name="foo"}
{/if}

Design tips

When you use Pockets in a theme, select “Custom” as a location. You can then to place it where you want it to appear.

You can also learn more about Pockets and customizing your theme, in our theme guide.

product

Share Your Thoughts

Your email address will not be published.

Adrian Speyer

Written by Adrian Speyer

Adrian Speyer is the Head of Community and Lead Evangelist for Vanilla by Higher Logic. Besides spending many years in digital marketing, Adrian has been building communities of all sizes for over 20 years.

Have an Article for Vanilla's Blog?

Send us an email to [email protected] with your topic idea and we'll circle back with our publishing guidelines.

subscribe-1
Subscribe to the Community Corner Newsletter and get expert insight and analysis on how to get the most out of your online community every Friday.

    Request a Demo

    Schedule a product demo now.

    Contact Us