Vanilla Forums
Community Blog

For Pros Just Like You

What's new!

5 Benefits of a B2B Customer Self Service Portal

We have covered the popular Pockets Addon before, but the below video goes into more detail on adding Google Adsense, inserting Google Analytics and also how you can use Pockets with your theme.

Read More

6 min

Adrian Speyer
Sarah Robinson-Yu

Pockets: Adding Custom HTML and Javascript to Your Vanilla Forum

2 minute read

July 8, 2014

We have covered the popular Pockets Addon before, but the below video goes into more detail on adding Google Adsense, inserting Google Analytics and also how you can use Pockets with your theme.

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

Adrian Speyer

Written by Adrian Speyer

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

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.

Customer Experience Update