I am creating a theme and I need some idea to create a below structure on my all the page except on the home page.

enter image description here

I know how to create a menu, sidebar, footer, and call dynamically on the page. My issue is, In which file do I have to edit it in my theme so that it will not affect on the home page.

1 Answer 1


I don't know if I understand you correctly, but probably in the file which calls get_sidebar():

You could do something like

if ( ! is_home() ) {

Or in your header.php where the main-element starts (which probably wraps the sidebar). You could give it a class if the page is not the home page:

<!-- body and header-stuff -->

<main class="<?php echo is_home() ? 'home-without-sidebar' : 'with-sidebar'; ?>">

<!-- other stuff -->

    if ( ! is_home() ) {

And then define CSS accordingly:

.home-without-sidebar {
    /* whatever properties */
.with-sidebar {
    display: grid;
    grid-template-columns: 20rem 1fr;
    /* more properties here */
  • Let me try your answer Commented Sep 30, 2021 at 7:32
  • Yes, It's working. Thank you for the help Commented Oct 9, 2021 at 12:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.