Support » Themes and Templates » Twenty sixteen: Remove sidebar and make content width 100% fro a specific page

  • Resolved giusec

    (@giusec)


    Hi,

    Does anybody know which css lines I need to edit to make sure that I can get the content to become 100% width of the theme only for specfic pages?

    Based on an existing post, I added the CSS code below (using the Jetpack CSS editor):

    #secondary {
    display: none;
    }

    @media screen and (min-width: 56.875em) {
    .content-area {
    width: 100%;
    }
    }

    This code will remove the sidebar from ALL posts/pages. Instead, I’d love to select which posts/pages I want to remove the sidebar from. What should I do?

    Thanks!!!
    Giuseppe

    • This topic was modified 2 years, 11 months ago by  giusec.
Viewing 3 replies - 1 through 3 (of 3 total)
  • the theme uses body_class() which geves each page its own specific CSS class;
    use that to create page specific formatting;
    https://developer.wordpress.org/reference/functions/body_class/

    example:

    .page-id-123 .content-area { width: 100%; }

    try using a browser inspection tool to find the CSS class for your specific page.

    The Jetpack CSS module (as far as I can tell) only lets you add custom CSS for the whole site. You could use a plugin called WP Add Custom CSS and this will install an extra CSS box under each of your pages and posts. Additionally, under this plugin’s settings you will be able to add CSS that will be sitewide, just like Jetpack CSS. Alternatively you should be able to add to styles.css (in a child theme) page specific CSS by targeting the page ID like this:

    .page-id-XX followed by custom CSS. You substitute XX for the page ID being targeted.

    Thank you Andrzej! Just tested the WP Add Custom Module and it works!

    Michael – I will check your solution as well. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Twenty sixteen: Remove sidebar and make content width 100% fro a specific page’ is closed to new replies.