Need to target topics & author for CSS

AI-generated summary

The discussion addresses a request to target specific authors within individual topics using CSS to highlight experts in threads with many replies. lisajill proposed adding new classes for topic IDs and usernames to enable granular styling, noting that category-level targeting is insufficient. zogstrip clarified that this functionality already exists using data-topic-id and data-user-id attributes, providing a CSS selector example. lisajill expressed gratitude and asked how to locate a user ID. riking explained that appending .json to a user’s profile URL reveals their ID in the response. lisajill confirmed the solution worked and closed the thread.

We have a need to target individual topics by CSS to highlight authors in specific ways for individual threads. The ultimate goal here is to make specific authors more visible in topics with many replies - but only in that thread.

So for instance, if we were having a question/answer session in this thread there might be a specific expert responding but that person should be ‘normal’ in the rest of the forums. So we would need two new classes for each topic (full thread including replies)

  • Class for each author (their username would be ideal)
  • Class for the topic ID

This would enable use to use something like this:

div.abc.xyz {
    /* rules go here */
}

to get very specific within-topic targeting. This would also allow us to highlight multiple ‘experts’ per thread as needed.

By category/group is not specific enough in this case. Can we get more granular?

I understand we’d need to add those rules for each topic in the Customize section which is perfect for our need.

Any chance this could be added?

You can already do that using “data-topic-id” and “data-user-id” :wink:

[data-topic-id="33027"] {
  [data-user-id="1995"] {
    /* rules goes here */
  }
}
6 إعجابات

Thank you!! :allthethings:

إعجاب واحد (1)

Oh! Quick q: where do I find the user ID?

Go to the user page, put .json on the end of the url, and look for "user":{"id":123, . It’ll be around the middle of the response :confused:

3 إعجابات

Thank you @riking!

This can be closed out, appreciate all the help!

إعجابَين (2)