[Product Post] Theme Tip: Promoted Content Module

Posted by Adrian Speyer on Nov 19, 2015, 9:52:07 AM
Find me on:

3 minute read

Have you ever wanted to promote content to your community based on an author's Role or Rank (or something else)? The Promoted Content module let's you do that easily, so you can have something like the following on your forum:

promoted-content

Criteria to choose

The first step in promoting content is deciding what selector criteria you'll use. Currently there are five ways to select promoted content:

  • role: Author's Role
  • rank: Author's Rank (requires Ranks plugin to be enabled)
  • category: Content's Category (url slug name)
  • score: Content's Score (requires Reactions plugin to be enabled)
  • promoted: is content promoted

Next you need to add the selection value. So for example if you choose a selector of role, your selection value would need to be the role, for example: "administrator".

{module name="PromotedContentModule" Selector="role"  Selection="administrator"}

You can also select the ContentType to fetch:

  • all (default)
  • comments
  • discussions

Finally, you can add some filtering. These are the available variables, where you will need to add an integer value:

  • Limit : How many pieces of  content you want to appear in the promoted content module. Default is 9.
  • Group: How often should we encapsulate content in groups. Groups of: n. Default is 3.
  • TitleLimit : How many characters to be used in the title
  • BodyLimit: How many characters to be used in the body
  • Expiry: How long do you want us to cache in seconds this content (default is set at 60 seconds)

Adding the module to your template

Using the above information, we can create a simple promoted content module using the below syntax:

{module name="PromotedContentModule" Selector="role" ContentType="discussions" Selection= "administrator" Limit="3"}

Selector is the criteria used to filter the type of content to select from, in this case role. The selection is the value, in this case administrator. Finally, we have decided to limit it to last 3 posts.

Once you have decided what you wish to select, place the code where you wish it to appear in the customize theme on the HTML tab. To place it in the side-panel, place it under {asset name="Panel"}. In our screenshot above, we placed it below {breadcrumbs} in the main content.

promoted-content-code

Making it look good

You can use CSS to make the Promoted Content module stand out by applying code to : .BoxPromoted. For example the following is the CSS used in the Bootstrap theme in the example found at the top of this post:

div.Box.BoxPromoted {
max-width: 875px;
margin-left: auto;
margin-right:auto;
}
.BoxPromoted .Item {
background-position: 0px -44px;
height: 180px;
width: 254px;
}

.BoxPromoted .DataList .Item {
border: 1px;
float: left;
margin-right:15px;
overflow:hidden;
text-overflow:ellipsis;
}

.BoxPromoted .DataList:after {
clear: both;
content: "";
display: table;
}

.BoxPromoted .DataList .Item .Title {
padding: 4px 0px 0;
overflow:hidden;
text-overflow:ellipsis;
}

Some people use a conditional so it only appears on the homepage. For example, the following is how you have it show only on the homepage when Category is set as your default:

{if InSection("CategoryList")}
{module name="PromotedContentModule" Selector="Role" ContentType="discussions" Selection= "Administrator" Limit="3"}
{/if}

Bonus

Here is the syntax for some of the promoted content modules:

Show only top 3 discussions with a content score of 5 and more:
{module name="PromotedContentModule" Selector="score" ContentType="discussions" Selection=5 Limit= "3"}

Show only top 3 comments with a content score of 5 and more:
{module name="PromotedContentModule" Selector="score" ContentType="comments" Selection=5 Limit= "3"}

Show only top 3 discussions from someone with rank named "Administrator":
{module name="PromotedContentModule" Selector="rank" ContentType="discussions" Selection= "administrator" Limit="3"}

Show only top 3 comments from someone with rank named "Administrator":
{module name="PromotedContentModule" Selector="rank" ContentType="comments" Selection= "administrator" Limit="3"}

We hope you found these tips helpful. Check under the product category for more product tips.

Topics: Product, News

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

community playbook

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.