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 this:
Here are some heavily themed examples, some of the more complex theming seen here would require a professional web developer, or you can engage Vanilla's Professional Services team to implement your theme for you.
Available Criteria
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 Rolerank
: 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? (requires Reactions plugin to be enabled)
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 titleBodyLimit
: How many characters to be used in the bodyExpiry
: 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.
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 communities choose to use a conditional so that the Promoted Content Module only appears on the homepage.
For example, if you wanted to 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: Example Code
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"}