• Hi,

    I created a child theme of virtue and a custom template. Now I am wondering how to fully remove all content of the page to have a clean and empty page, because when I have an empty template the header, sidebar and footer are still visible, even though the template’s code is empty.

    More importantly, I would like to know how I can remove the sidebar for a single page.

    Thanks for your help!

    • This topic was modified 5 years, 10 months ago by datakimchi.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    What kind of layout are you going for? It’s possible that you may be able to achieve your goals without a child theme.

    Can you post a link so that I can take a look at how it’s being output?

    -Kevin

    Thread Starter datakimchi

    (@datakimchi)

    I am using php in a separate file to retrieve data from a database and I may add php in the blog page too. So I think I am better to go with a child theme.
    Here is a link to said site:

    https://geolic.net/the-football-kit-war/

    You can unhook the sidebar using this function:

    function kad_sidebar_on_custom_page_template( $sidebar ) {
      if ( is_page_template( 'page-custom.php' ) ) {
        return false;
      }
      return $sidebar;
    }
    add_filter( 'kadence_display_sidebar', 'kad_sidebar_on_custom_page_template' );

    Just change page-custom.php to the name of your template.

    Did you also want to unhook the header and footer?

    Ben

    Thread Starter datakimchi

    (@datakimchi)

    Great! It works!

    It may be helpful to know how to disable this for a single page as well if you don’t mind. I may post a special blog post without any header or footer.

    Thanks for the support!

    To remove the header and footer you would make a “base” template

    Lets say your custom template is called page-custom.php

    You would then make a template called base-page-custom.php

    In that base template you can copy the items out of base.php which is in the the theme and remove parts you don’t want like the header and footer.

    Let me know if that helps,

    Ben

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove sidebar in custom template’ is closed to new replies.