• 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 1 year, 5 months ago by omniafausta.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @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:

    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

    (@omniafausta)

    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.

    Hi @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.