• How do I remove a sidebar from just certain post types?
    I am ok with the widgets on the sidebar and the footer on my blog pages, but I have a post type that got introduced through my theme (“Albedo” from Graph Paper Press) and the plugin “Sell Media” by the same company. They say that this is extended customization beyond the normal scope of support….

    An example page that I am trying to free from the sidebar and widgets is this gallery page:
    http://www.heidgermarx.com/galleries/cars-at-night/
    OR: http://www.heidgermarx.com/galleries/cars-at-night/?id=2434
    (it would be great if I could have the sidebar with the widgets removed and the image with the “Details” and “Camera Info” extended into the area that was formerly used up by the sidebar, if that is possible?)

    My homepage is: http://www.heidgermarx.com

    Thanks so much for your help and ideas in advance!!
    heidger

Viewing 13 replies - 1 through 13 (of 13 total)
  • Anonymous User 14733231

    (@anonymized-14733231)

    Hello,

    Please make one backup of your css file once. after add bellow code to hide sidebar.

    This will hide sidebar
    .single-sell_media_item #secondary {display:none;}

    This Will make content area in full width
    .single-sell_media_item .has-sidebar #content {width:100%;}

    Thread Starter heidger

    (@heidger)

    Thanks so much, Neal007!! You are a genius!!

    I used the first line .single-sell_media_item #secondary {display:none;}
    and the sidebar disappeared on the Sell Media post types!

    But when I added the second line that you recommended .single-sell_media_item .has-sidebar #content {width:100%;} to the CSS file, nothing changed and the width remained the same as with the first line of code….

    Do you have any other ideas?

    Thanks so much for all this already!
    heidger

    Anonymous User 14733231

    (@anonymized-14733231)

    Ok will post better idea Tommorow morning on my working day.

    Thread Starter heidger

    (@heidger)

    Thank you, Neal007! Looking forward to your idea tomorrow! -heidger

    Anonymous User 14733231

    (@anonymized-14733231)

    Hello heidger,

    Please try

    .sell-media-single-two-col.has-sidebar #content{width:100% !important;}

    Thread Starter heidger

    (@heidger)

    That worked!! Thanks so much, Neal007!
    You are a genius!
    heidger

    Anonymous User 14733231

    (@anonymized-14733231)

    Thanks heidger,

    Let me know if I can help you out further

    Thanks,
    [Skype details moderated]

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    @Neal007, Please don’t ask people to contact you or provide your contact information.

    Hi Neal007, I’m having the same problem. I tried pasting your code but it didn’t work.

    Do I paste it in style.css? I don’t see any other css file available to edit.

    Thanks in advance!

    Yuk, CSS to hide a sidebar. Not even close to correct way of doing it. To hide a sidebar from certain pages you would use something like this within your template code before the sidebar getter;

    <?php if ( !is_page('name of page you don't want to display on') ); ?>
            <?php get_sidebar(); ?>
    <?php endif; ?>

    Or download the plugin Widget Logic and you can control what widgets are shown or what page with the same logic as is_page(‘name of page’)

    That’s a much better solution then CSS doing display:none.

    Here’s a reference to what I’m referring to as proper practice for this;
    http://codex.ww.wp.xz.cn/Conditional_Tags

    Hey CureWP, thanks for your post!

    Your code didn’t work for me exactly. I put the title of my post as suggested on the conditional tags link and pasted your code right before the <?php get_sidebar(); ?> command in my Single Post (single.php) file.

    But when I went to load the page, it was just white. The entire browser page was white. Couldn’t figure out why.

    Instead, I just nixed the <?php get_sidebar(); ?> code that existed, because I don’t want a sidebar on ANY of my posts. It worked.

    But for learning purposes, can you tell me why the first way might not have worked for me?

    Cheers!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    But for learning purposes, can you tell me why the first way might not have worked for me

    It was superficially hidden. It was only made invisible. The sidebar was still there. This means that it will still be visible to search engines.

    Note that @CureWP’s change should be implemented in a Child Theme: https://codex.ww.wp.xz.cn/Child_Themes

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Remove sidebar’ is closed to new replies.