Sticky Footer Ad

AI-generated summary

A user, falcon9, wants to display a sticky footer ad only to certain user groups, including all guests and all groups except a paid membership. MrDavis97 suggested wrapping the sticky footer code in a CSS class that targets the user’s primary group, which can be set at https://yoursite.com/g/{paid_group}. By adding a CSS rule .primary-group-GROUP_NAME .sticky-footer { display: none; }, the sticky footer will be hidden from users in the paid group. Additionally, a theme component that adds all user groups as CSS classes to the <body> tag may be useful in more complex cases.

I am working with an ad company and trying to show their sticky footer code to only certain user groups. Is there any code that I can wrap the sticky footer in to make sure it only displays for the user groups that I want it to? It would need to display for all guests and all of my user groups except for one which is a paid membership.

First, make sure that the paid membership group is set to be the user’s primary group if they’re in that group (this can be done at https://yoursite.com/g/{paid_group}). Once that’s done, whenever a user is in that group, they’ll get a nice primary-group-GROUP_NAME class appended to the <body> tag. Now you can do something like

.primary-group-GROUP_NAME .sticky-footer {
    display: none;
}

so that the sticky footer will show up for everyone but those in the paid group.

This should be sufficient for your purposes. But note that there is also this theme component that adds all of the user’s groups as CSS classes to the <body>, which might help in more complex cases.