Title: Current user posts custom css
Last modified: August 9, 2019

---

# Current user posts custom css

 *  [Gustav](https://wordpress.org/support/users/4ever16/)
 * (@4ever16)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/current-user-posts-custom-css/)
 * I want that if a user is logged in he has post his posts will be colored different.
   Only that user can see that special .css
 * Something like this.
 *     ```
       If user is logged in mark his posts with white background else do nothing.
       .type-post, .type-page, .type-attachment, .comments-area, .comment-respond {
       background: #fff;
       }
       ```
   
    -  This topic was modified 6 years, 9 months ago by [Gustav](https://wordpress.org/support/users/4ever16/).

Viewing 1 replies (of 1 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [6 years, 9 months ago](https://wordpress.org/support/topic/current-user-posts-custom-css/#post-11816728)
 * So what I’d do is write a filter on [body_class](https://codex.wordpress.org/Plugin_API/Filter_Reference/body_class).
   In that code, I’d check to see if the viewer is logged in. If so, then I’d check
   to see if I were viewing a single post and add a class to the body, something
   like “is_author”. If this is a post archive, I’d do the same for the [post_class](https://developer.wordpress.org/reference/hooks/post_class/).

Viewing 1 replies (of 1 total)

The topic ‘Current user posts custom css’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/current-user-posts-custom-css/#post-11816728)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
