How to change sidebar per page?

I am new to theming with wordpress. I have a theme layout with one sidebar at the right side of the website.

Now on my homepage and one other page i dont want to have the sidebar. On all other pages it needs to stay. How can i do this.

Read More

Any help would be appreciated.

Thanks.

Related posts

Leave a Reply

3 comments

  1. … on my homepage and one other page
    i dont want to have the sidebar.

    You can tell WordPress to do not generate sidebar on specific page(s) with simple condition in your page.php file (or other relevant template file).

    For example the following piece of code will disable sidebar on ‘About Me’ page.

    <?php if (!is_page('about-me')) get_sidebar(); ?>
    

    *Note: you can use numeric ID or slug of your page inside the is_page() function.*