Site logo

Archived topic

How to use custom padding for single post exclude specific category?

5 replies · Started by Trạng on December 11, 2021

Viewing posts 1–6 of 6

Hi there, I'm using this custom css code for my single post padding in Blog category.

/** Single post padding **/
@media(min-width: 769px) {
    .single.separate-containers .inside-article,
    .single.separate-containers .comments-area,
    .single.separate-containers .page-header,
    .single.separate-containers .paging-navigation,
    .single.one-container .site-content,
    .inside-page-header {
        padding: 30px 20px 120px 150px;
    }
    .site-content .is-right-sidebar {
        width: 29%;
    }
}

But I don't want it effect all the posts in my Buying guide, review category because of those posts I just use content no sidebar layout.

So let's say:

+ In buying guide, review category -> I use element "post width layout" & tick to no sidebar
+ All other posts, I use content/sidebar layout.

Can anyone help me with this problem?

Still wait for the support

Hi there,

if you want that CSS to only apply to posts that have the right-sidebar then include that body class in your CSS:

/** Single post padding **/
@media(min-width: 769px) {
    .single.separate-containers.right-sidebar .inside-article,
    .single.separate-containers.right-sidebar .comments-area,
    .single.separate-containers.right-sidebar .page-header,
    .single.separate-containers.right-sidebar .paging-navigation,
    .single.one-container.right-sidebar .site-content,
    .right-sidebar .inside-page-header {
        padding: 30px 20px 120px 150px;
    }
    .site-content .is-right-sidebar {
        width: 29%;
    }
}

Thank David,

It works but now in the "non-right-sidebar" post -> the top & bottom padding is remove. How could I fix it?

Screenshot 1
Screenshot 2

This archived topic is closed to new replies.