0

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

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() ) {
    get_sidebar();
}

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 -->

<?php
    if ( ! is_home() ) {
        get_sidebar();
    }
?>

And then define CSS accordingly:

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

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