How to add the sidebar to all the pages except the home page?

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.

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.

Topic php plugin-development theme-development html5 themes Wordpress

Category Web


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 */
}

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.