# CSS selector to separate posts by current user

**URL:** <https://meta.discourse.org/t/css-selector-to-separate-posts-by-current-user/146267>\
**Category:** Development\
**Created:** [March 31, 2020, 12:54pm UTC](https://meta.discourse.org/t/css-selector-to-separate-posts-by-current-user/146267 "2020-03-31T12:54:34Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![zcuric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zcuric/32/292837_2.png) [@zcuric](https://meta.discourse.org/u/zcuric)\
**Post date:** [April 1, 2020, 8:58am UTC](https://meta.discourse.org/t/css-selector-to-separate-posts-by-current-user/146267/8 "2020-04-01T08:58:54Z")

</div>

After digging a bit in plugin-api I think I found solution to your problem and the proper way of doing what you suggested

```plaintext
<script type="text/discourse-plugin" version="0.8">
  api.addPostClassesCallback((attrs) => {
    const user = api.getCurrentUser();
    if (attrs.user_id === user.id) {
      return ['current-user-post']
    }
  });
</script>

```

Check here:  
[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/plugin-api.js#L712](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/plugin-api.js#L712)

This will add `current-user-post` to every post that is made by a current logged in user.

---

_[View the full topic](https://meta.discourse.org/t/css-selector-to-separate-posts-by-current-user/146267)._
