Title: different classes for different side bars?
Last modified: June 8, 2023

---

# different classes for different side bars?

 *  [omniafausta](https://wordpress.org/support/users/omniafausta/)
 * (@omniafausta)
 * [3 years ago](https://wordpress.org/support/topic/different-classes-for-different-side-bars/)
 * hi, I can’t see a different class for a different (custom) side bar… I want to
   do a bit of different styling on the different side bars, but I do not see an
   option to do this because the custom sidebar does not appear to have a different
   class or id… Am I overlooking something or should I find another custom sidebar
   plugin?
    -  This topic was modified 3 years ago by [omniafausta](https://wordpress.org/support/users/omniafausta/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Shahin](https://wordpress.org/support/users/skalanter/)
 * (@skalanter)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/different-classes-for-different-side-bars/#post-16814337)
 * Hello [@omniafausta](https://wordpress.org/support/users/omniafausta/),
 * Where do you have a custom sidebar?
    You can find the body tag class and use 
   the JS below to add a custom class for the custom sidebar.
 * Please put the CSS below in Customizing > Custom CSS/JS > [Custom JS](https://docs.oceanwp.org/article/354-add-custom-css-and-js-to-your-website):
 *     ```
       jQuery(document).ready(function() {
         jQuery('body.single-post .sidebar-primary').addClass('my-custom-class');
       });
       ```
   
 * In the above code, we use the `jQuery(document).ready()` function to ensure that
   the code runs after the document has finished loading. Then, we select the body
   element using the `jQuery('body')` selector and use the `addClass()` function
   to add the class `my-custom-class` to it.
 * I hope it helps.
 * Best Regards
 *  Thread Starter [omniafausta](https://wordpress.org/support/users/omniafausta/)
 * (@omniafausta)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/different-classes-for-different-side-bars/#post-16815757)
 * Thanks for your reply.
 * I will look into your method, but for now I have found a workaround by adding
   a class to the body and then using that to style the sidebar on pages with that
   body class differently.
 *  [Shahin](https://wordpress.org/support/users/skalanter/)
 * (@skalanter)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/different-classes-for-different-side-bars/#post-16820509)
 * Hi [@omniafausta](https://wordpress.org/support/users/omniafausta/),
 * I’m glad that you were able to resolve that.
 * Best Regards

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘different classes for different side bars?’ is closed to new replies.

 * ![](https://ps.w.org/ocean-custom-sidebar/assets/icon-256x256.png?rev=2670316)
 * [Ocean Custom Sidebar](https://wordpress.org/plugins/ocean-custom-sidebar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ocean-custom-sidebar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ocean-custom-sidebar/)
 * [Active Topics](https://wordpress.org/support/plugin/ocean-custom-sidebar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ocean-custom-sidebar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ocean-custom-sidebar/reviews/)

## Tags

 * [class](https://wordpress.org/support/topic-tag/class/)
 * [css](https://wordpress.org/support/topic-tag/css/)

 * 3 replies
 * 2 participants
 * Last reply from: [Shahin](https://wordpress.org/support/users/skalanter/)
 * Last activity: [2 years, 12 months ago](https://wordpress.org/support/topic/different-classes-for-different-side-bars/#post-16820509)
 * Status: not resolved