How to use banner topic feature for specific group?

I think I’ve got a solution for you, but there will be several pieces of the puzzle you will need to fill in yourself:

Go to the topic you are using for your banner topic. What you will need to do is create sections in the post that are specific for each group. So for example:

<div data-theme-group="GROUP_ONE">

# Banner 1

</div>

<div data-theme-group="GROUP_TWO">

# Banner 2

</div>

<div data-theme-group="GROUP_THREE">

# Banner 3

</div>

Anything you place within the <div>s will be specific to the group you are targeting. Anything outside of the <div>'s will be shown to everyone. We’ll use CSS to control what is seen given a user’s group:

// Hide all by default
#banner [data-theme-group] {
    display: none;
}
// Show specific content for a specific group
body.primary-group-GROUP_ONE   #banner [data-theme-group="GROUP_ONE"],
body.primary-group-GROUP_TWO   #banner [data-theme-group="GROUP_TWO"],
body.primary-group-GROUP_THREE #banner [data-theme-group="GROUP_THREE"] {
    display: block;
}

Let me know if you need me to clarify anything. There may be a cleaner implementation of this, but it’s what I could come up with quickly. This can also be used to control different banner content for different categories with a little alteration to the code.

Also just a reminder that this still applies:

4 Likes