Pockets: Adding Custom HTML and Javascript to Your Vanilla Forum
<br />
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.