• I’ve tried using custom page templates but they don’t seem to do anything, which I think is because I need to change the file ‘index.php’ as well. However, this would affect all the pages on my website. Is there a way to remove the sidebar (and make the page content full width) but only for certain pages?
    I would greatly appreciate any help. Thanks
    The website is: https://www.freshyoutubers.com/

Viewing 15 replies - 1 through 15 (of 24 total)
  • I would like to know this also! My instinct is the same as yours, but I’m new to scripting so can’t offer much advice. Perhaps have a look at a theme like one of the automatic ones (2016, 2014, 2015 – one of them did it) which display the pages differently, and study how. Does WordPress have any tutorials or further information on the topic, even if not nisarg-specific?

    dreamingsentinel

    (@dreamingsentinel)

    @webbersky (because you’ve been so helpful and seem so knowledgeable on the subject)

    After reading WordPress’s info on Page templates I tried creating a page specific page-gallery.php and index-gallery.php (I have no idea whether that’s efficient scripting or not) and removed get_sidebar() from both, as Falguni suggested.

    However, this doesn’t seem to have changed anything, and when trying to create a non-specific page-template.php there is no option to select it under page attributes. I’m really at a loss here as PHP is much more complex to grasp than CSS.

    If you know anything that might help, or someone else who might, please let me know, I would really appreciate it as I’m at a complete and utter loss. My website’s https://www.thedreaming.is, though I’ve been working on a local version for any new changes.

    webbersky

    (@webbersky)

    Create a new file called no-sidebar-page.php in /wp-content/themes/nisarg/
    Copy the contents from /wp-content/themes/nisarg/page.php into no-sidebar-page.php
    Then change this line:
    <?php get_sidebar(‘sidebar-1’); ?>
    to
    <?php //get_sidebar(‘sidebar-1’); ?>

    and replace the commented code at the top (lines 2-11) with:
    /*
    * Template Name: No Sidebar Page
    */

    Then select your Page on wp-admin and under Page Attributes, you will have option to choose your page Template, so you can select the pages you don’t want to have a sidebar.

    Hope this helps ??

    dreamingsentinel

    (@dreamingsentinel)

    Thank you so much, you are amazing! I’d give you a hug but that’s not exaclty going to work over digital communications ?? But I really appreciate your response, it means a lot to me.

    I want to customise this to make the center scroll make up for the missing space, but I’m unsure how to do that through bootstrap without effecting all the pages.

    Should I make some sort of if statement on no-sidebar-page.php/other with instructions on running a seperate bootstrap file? Like (I have the barest idea of how this works, you’ll probably find this very amusing):

    if ( is_no-sidebar-page.php() ) :
    run( ‘some sort of specific bootstrap file (like the new one we made for the page), including the customizations but isn’t run on any non no-sidebar-page template displays?’ );
    elseif ( is(page.php) ) :
    run( ‘usual bootstrap file’ );
    endif;

    ? Usually I make my customisations through stylesheet.css, is there a way to use css to customise the new page template as well? I suspect not, but I’m much for familiar with it ??

    Once again, many thanks ?? ??

    webbersky

    (@webbersky)

    Put this code (change domain.com to your domain)
    <link rel=’stylesheet’ id=’nisarg-style-css’ href=’https://domain.com/wp-content/themes/nisarg/style2.css&#8217; type=’text/css’ media=’all’ />

    after
    get_header(); ?>

    Which will then load another stylesheet after the main ones so will overwrite the previous styles I believe.

    Then create a file called style2.css
    and add in your CSS code there.

    Not sure what you want to do exactly but if you want to make the main page part wider
    set this (was 75%):

    @media (min-width: 992px) {
    .col-md-9 {
    width: 100%;
    }
    }

    This probably isn’t the best way of doing it as it loads the css file outside <head> tag but it appears to work.

    dreamingsentinel

    (@dreamingsentinel)

    Thank you ?? ??

    I’ve put the code into no-sidebar-page.php, and it’s reading style2.css through WordPress, however I can’t find the line of code you’ve suggested I change – I’ve tried searching several different keywords to no results.

    I’ve also tried placing the line in as is as the last in style2.css, but it doesn’t seem to change anything. I’ve done some tests with other changes and none of them in style2.css seem to have an effect on the theme display.

    Have you been doing this in a child theme? I’ve been working in the parent as none of the changes at making no-sidebar-page.php seemed effective unless they were in the parent, but could the child’s style.css preferences now be overriding?

    dreamingsentinel

    (@dreamingsentinel)

    I have this working on the child theme now, it was an error in the local setup.

    Your script works when I put it in through a plug in, which is good ?? I’m hoping to find a way around it with further research, it seems that style2.css is just not overriding anything / being activated. Worst comes to worst I’ll have to stick with the plug-in -.-

    Thank you a lot, Webbersky, you’ve really helped me ?? And I’ve learned a lot, which is even more valuable. Hopefully now @dodo9999 can mark this as resolved ?? I’m sure you’ve helped both of us!

    Hello,
    I’m having trouble extending the middle column to the full page. @dreamingsentinel what plugin did you use?

    I also tried to follow along with this thread, (https://www.ads-software.com/support/topic/nisarg-remove-sidebar-1/) but the line numbers did not match up for every line.

    Post your website and I can take a look for you.

    I’m using WP Add Custom CSS (https://www.ads-software.com/plugins/wp-add-custom-css/)

    I don’t know if the lines of script adding up are important, different versions of the website would be different / updated, whatever. Just use the ctrl f find in page option and search and replace / remove the lines, and in custom css just add what’s in this thread to ovveride.

    I think this is what I’m using (it’s been a while):

    @media (min-width: 992px) {
    .col-md-9 {
    width: 100%;
    }

    Latest WordPress has Custom CSS if you go on Customize, shouldn’t need plugin for it now.

    And I can’t really check for you unless i know your site, but yes line numbers may have changed by now, but try search and replace what i’ve said in this thread.

    Thanks @webbersky and @dreamingsentinel

    Sorry for the delay getting back to you, I forgot to click the link to get replies via email and got busy with another project.

    I only want to apply this to specific pages and these are the two that I am working on:

    This was built using Page Builder ( https://sherylsteines.com/test/) and I am trying different layouts on it. It is not accessible from the main site and will replace the production page which is below.

    The production page was built with TablePress and will be removed once the PageBuilder page is finished: https://sherylsteines.com/wizard-hall-chronicles/

    I know that I did the following based on this thread.

    Since I could not find this section of code:

    @media (min-width: 992px) {
    .col-md-9 {
    width: 100%;
    }
    }

    I found part of it on Line 1596 and changed 75% to 100%:

    @media (min-width: 992px) {
    .container {
    width: 100%;

    Then I found .col-md-9 on Line 1949 and changed 75% to 100%

    .col-md-9 {
    width: 100%;

    Thanks for your help.

    Hello!
    I’m struggeling with the same thing…could you please take a look at my site and tell me how to get full width and centered?

    Thank you in advance!

    I don’t know the URL for your website @tebmedia

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Nisarg-How to remove sidebar on certain pages’ is closed to new replies.