Remove sidebar from Blog page

I’m trying to remove the sidebar from the blog page. The blog page is not on the home page. I created a page and gave it a title of Blog. Then in the Blog page editor under Templates I selected Custom Template. Then when I go to the Reading section under settings I selected Blog for the Posts page, but when I go to the blog page it still has the sidebar.

In the display_sidebar function in setup.php I put is_page(‘blog’) and is_page(‘6743’) (which is the page’s id). I tried other things to, but nothing seems to work. Is there any way to identify this page so that it will return true for display_sidebar function? When I use the What the File plugin to see which template is being used, it returns base.php.

I even tried making a new template: blog-template.php and gave it a Template Name of Blog Template and selected that template in the Blog page editor without selecting anything for Posts page in the Settings > Reading page and that didn’t work.

What is the best way to make a blog page that is not on the home page, but has no sidebar

Thanks

Have a look here:
https://codex.wordpress.org/Conditional_Tags#The_Blog_Page

1 Like

Solved. Thanks so much for your reply. I wasn’t sure whether this was a WP or Sage issue. Sorry to ask a WP issue here. I did search the group before I asked the question and I saw the reply’s saying to use is_home(), but I thought they were referring to a blog that was actually on the front page or root domain i.e. example.com.

I even searched google several times in the past in addition to just before asking this question and I would always find this link: https://gist.github.com/wesbos/1189639 which led me to believe that wp had no function to serve this purpose.

But hopefully this archive may help future inquisitors understand that is_home() will work for the Posts page selected on the Settings > Reading page when you select “A static page” under “Front page displays” which is not on the root domain i.e. example.com/blog while wp is installed in example.com.

1 Like