Newbie – Independent Publisher Theme Removing Sidebar on posts/pages
-
Hi,
I’m quite new to WordPress and also CSS. I’m a network engineer by but am trying to develop a blog site and learn about CSS.
On my blog I’d like to remove the widgets and sidebar from certain posts and pages, but am not sure how to do this with CSS.
If anyone could help with this I’d very much appreciate it.
Thanks
SteveThe blog I need help with is: (visible only to logged in users)
-
Hi Steve, and it looks like you have a good start on your site. :)
To hide certain widgets from select pages, you can use the Widget Visibility feature, which requires no CSS.
To hide the sidebar completely from select pages and posts, we have to target those pages or posts by using the unique page or post id in the opening HTML body tag for that page or post. As an example, if you view the source code for your home page, you will see that the opening body tag starts out like this.
<body class="home page page-id-62...
To hide the sidebar on the home page, we would then do this..page-id-62 #secondary { display: none; }On posts, such as your BGP L2VPN post, if you view the source you will see the opening body tag starts like this.
<body class="single single-post postid-619...
So instead of .page-id-62, you would use .postid-619 to target that specific post.I used the web inspector built into my browser to find the relevant CSS. If you are not familiar with the web inspector in your browser, take a look at our support page on How to Find Your Theme’s CSS where you will find some brief screencasts to get you started with it. I find it an invaluable tool when working with CSS.
-
Hey thanks so much for the detailed response. I’ll have a look at that tomorrow and will report back!
Cheers
Steve :) -
-
That’s very useful, so I basically go into the theme customiser and add the CSS elements for the entire site and keep saving the changes.
So would I be right in assuming that there’s CSS for lots of different things I might want to do to customise the site? For example I want to widen the posts and pages that don’t have the sidebar, and also might in future want to add pictures in different places in the pages, and possibly also videos from youtube.
Thanks for your help, anything you can point we towards would be very much appreciated :)
-
You can insert images and videos directly into the content of pages and posts. For videos, you can use shortcodes for many of the popular video services, or you can upload and insert videos of your own with VideoPress, which is part of the WordPress.com Premium Plan.
With CSS, you can make a lot of changes to your theme to personalize it and make it look the way you want it too. There are some limitations, but most things a user would want to do can be done.
- The topic ‘Newbie – Independent Publisher Theme Removing Sidebar on posts/pages’ is closed to new replies.