Hide sidebar on specific posts/pages
-
Hi,
Is there a way to remove the sidebar from specific posts/pages in the Virtue Child theme?
My client is creating courses using the Zippy Courses plugin. But she doesn’t want her sidebar appearing on the course pages. She would rather have each of these pages be fullwidth.
I’m not sure if you will be able to access the page link I sent you. This is the CSS I tried using to hide the sidebar on the first of the course pages she has created but it did not work.
.postid-25332 .kad-sidebar {
display: none;}Would you know the correct CSS to achieve this?
Thank you ??
The page I need help with: [log in to see the link]
-
Hello,
All you need to do is go into the page settings and assign the fullwidth template.
See here:
https://docs.kadencethemes.com/virtue-free/fullwidth-page-template/Let me know if that works for you.
-Kevin
Hi Kevin,
That was what I initially thought – but when I opened the page – there is no box with “Page Attributes” available. She has “Publish” “HTTPS” “Featured Media” “Likes and Shares” and “Yoast Internal Linking”. She’s using Thrive Architect and Zippy Courses within the Virtue Child Theme. But when I go into these plugins – neither of them has a sidebar element. Her sidebar is the same on all of her pages – (I checked in her Menus area) so it seems to be the one she originally built using the Virtue Child Theme.
So my next thought was that I could hide the sidebar widgets on specific pages by simply targeting each post id with CSS. But the CSS .kad-sidebar doesn’t seem to work by itself.
I noted the .kad-sidebar item in Inspect Element and thought that was the correct one to use to target the sidebar. But it doesn’t seem to work. Is there another CSS selector that I should use in combination with .kad-sidebar to hide the sidebar on specific posts/pages?
Thanks,
Meagan
I don’t think the sidebar is being added within the child theme.
Back in your page edit screen, try opening screen options at the top of the page.
Is page attributes selected in the screen options?
-Kevin
Hi Kevin,
No – there is no check box for Page Attributes in the screen options at the top of the page.
In Inspect Element this is the CSS I am seeing – but when I target the .kad-sidebar and use the post-id – it does not hide the sidebar.
<aside class=”col-lg-3 col-md-4 kad-sidebar” role=”complementary” itemscope=”” itemtype=”https://schema.org/WPSideBar”>
<div class=”sidebar”>In the right-hand box under the Styles Tab there is also an additional css selector called .single-article aside (but that doesn’t seem to select the entire sidebar.
So is there no other way to hide a sidebar in WordPress other than using the Page Attributes?
And if the Page Attributes is not showing up on her pages for her courses (they look identical to any other WordPress page – just missing the Page Attributes selection) – do you think this is the being caused by the Zippy Courses Plugin?
Thank you
Btw- I’m sorry for my lag in response time – my schedule got a bit crazy at the end of the week. I’m sure you know what that’s like. ??
Hey Maggie,
For posts, in your edit page under Post Options you should see an option to display or hide the sidebar. Do you see that?You should still be seeing page and post attributes in your pages and posts. Can you send a screenshot of your screen options?
Hannah
Hi Hannah,
I took a screenshot of each section of the page starting from the top. I’m not sure you will be able to view these? (It only lets me copy and paste into this screen.)
Screen Shot 2018-08-27 at 2.21.18 PM
Screen Shot 2018-08-24 at 9.10.51 AM
Screen Shot 2018-08-24 at 9.11.10 AM
Screen Shot 2018-08-27 at 2.21.50 PMThere are just no Page Attributes listed anywhere on the page. But on all of my client’s other Pages and Posts she has the Page Attributes available.
In the Help documentation for the Zippy Courses plugin, there is a screenshot of a Zippy Course Page that clearly shows the Page Attributes section on the right side of the page. So I am not entirely certain why it is not visible on my client’s course page.
Thank you for looking into this as far as you are able to.
Maggie
Hey,
Your screenshots aren’t showing. You can host images and link to them with this site:
https://postimages.org/If the plugin is hiding options within your page edit screen, you may want to open a support ticket with zippy courses.
-kevin
Hi Kevin,
I have a feeling it might be the plugin – but I am never sure. Here are the screenshots. I’ll follow up with the folks over at Zippy Courses. Just thought if there was a way to hide a sidebar on specific pages/posts in the Virtue Child theme using CSS – that could resolve the issue.[url=https://postimg.cc/image/u8u9ebv5n/][img]https://s33.postimg.cc/u8u9ebv5n/Screen_Shot_2018-08-27_at_2.21.18_PM.png[/img][/url]
[url=https://postimg.cc/image/40j4p1b2z/][img]https://s33.postimg.cc/40j4p1b2z/Screen_Shot_2018-08-27_at_2.21.39_PM.png[/img][/url]
[url=https://postimg.cc/image/8mf8xe4bv/][img]https://s33.postimg.cc/8mf8xe4bv/Screen_Shot_2018-08-27_at_2.21.50_PM.png[/img][/url]
Thanks,
Maggie
Sorry, I didn’t realize you weren’t working in a normal post or page.
In Theme Options > Page/Post Settings do you have “Default Page Template – Sidebar Default” set to hide sidebar?Hannah
Hi Hannah,
I apologize for the late reply – I was at work today –
I just checked in Page/Post settings and she has “Default Page Template – Yes Sidebar”.
If I have my client select the “No Sidebar” option – does that remove the sidebar from all of her posts/pages and somehow give her back the Page Attributes selection so she can choose which posts/pages to have her sidebar appear on?
She also has “Single Page Width Content” set to “Contained” – not sure if that matters or not.
Thanks,
Maggie
Hi Hannah –
Just a quick follow up – I went in and changed the Default Page Template to “No Sidebar” and nothing changed. The sidebar is still there and the Page Attributes selection does not appear in the screen options.
I am really stumped. Phew.
I discovered that I cannot remove the sidebar from any of her “Posts”.
I can remove the sidebar from all of her Pages when I change the Default Page Template to “No Sidebar”.
But I tried removing the sidebar on several of her blog posts using the Default Page Template – no Sidebar – method and nothing happened. And each Zippy Course is set up in a “Post”, not on a “Page”.
Is there a way to remove a sidebar from actual Posts instead of Pages?
Maggie
In the premium version you can remove sidebars from specific posts. However, in the free version you can either turn your sidebar on for all your posts, or off for all posts. If you want you can use post specific css to hide a sidebar from certain posts.
Hannah
Hi – is there perhaps a way to create a custom single post template that lets her remove the sidebar from specific “posts”?
My problem is that I am not well-versed in PHP – and she is using a child theme. So I’m Googling.
But when I look at instructions for creating a single post template – I am not sure which of the files inside of the virtue theme I am supposed to copy in order to build a new template in her child theme. (or what the code is for allowing her to remove a sidebar from specific posts)
In cPanel – in her Virtue theme – the single.php file only has a single line of code:<?php get_template_part( ‘templates/content’, ‘single’ ); ?>
I’m not sure how to build a template for single posts without a sidebar from that.
In index.php there is the following:
<?php
if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly
}
/**
* @hooked virtue_page_title – 20
*/
do_action( ‘virtue_page_title_container’ );
global $virtue_sidebar;
$virtue_sidebar = true;
?><div id=”content” class=”container”>
<div class=”row”>
<div class=”main <?php echo esc_attr( virtue_main_class() ); ?> postlist” role=”main”><?php if ( !have_posts() ) : ?>
<div class=”alert”>
<?php esc_html_e( ‘Sorry, no results were found.’, ‘virtue’ ); ?>
</div>
<?php get_search_form();
endif;while (have_posts()) : the_post();
get_template_part( ‘templates/content’, get_post_format() );
endwhile;/**
* @hooked virtue_pagination – 10
*/
do_action( ‘virtue_pagination’ );
?></div><!– /.main –>
Is there a way to create a single post template from this file that would give her the ability to remove the sidebar on specific posts without removing it on all pages or other posts?
Thanks!
I have to apologize, Maggie. I somehow overlooked the option in Virtue free to choose to show or a hide a sidebar for specific posts. In your post edit page under Post Options, you should see an option to show or hide the sidebar and also choose which sidebar to show. Do you see that?
Hannah
- The topic ‘Hide sidebar on specific posts/pages’ is closed to new replies.