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

Home Forums Support [Resolved] How to use custom padding for single post exclude specific category?

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

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2046185
    Trạng

    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.

    #2046415
    Trạng

    Can anyone help me with this problem?

    #2046617
    Trạng

    Still wait for the support

    #2046633
    David
    Staff
    Customer 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%;
        }
    }
    #2046920
    Trạng

    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

    #2046961
    Elvin
    Staff
    Customer Support

    Hi there,

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

    I believe this is related to your other opened topic.

    Please see my reply. 🙂
    https://generatepress.com/forums/topic/setting-top-bottim-padding-for-page-layout/#post-2046959

    Note: You may have to set the parent selector for #content if you have any specific condition.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.