<img height="1" width="1" style="display:none" src="https://q.quora.com/_/ad/10b616b60fad4a51aa023ade12476783/pixel?tag=ViewContent&amp;noscript=1">

Pockets: Adding Custom HTML and Javascript to Your Vanilla Forum

Posted by Adrian Speyer on Jul 8, 2014 9:08:34 AM
Find me on:

2 minute read

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.

Topics: Product

Related posts

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.

Search this blog

Recent Posts

Gaming Launch Guide

Have an Article for Vanilla's Blog?

Send us an email to pr@vanillaforums.com with your topic idea and we'll circle back with our publishing guidelines.