How To Hide Your WordPress Blog Sidebar On Date-Based Archive Pages

Your WordPress blog sidebar is an essential element of your blog, however, on some occasions you might not want it to be displayed on your date-based archive pages.

To hide your sidebar on your date-based archive pages, edit the archive.php file from your theme (if your theme doesn’t include this file, edit the index.php file) and look for the following snippet of code:

<?php get_sidebar(); ?>

and replace it with:

<?php if(!is_year() || !is_month() || !is_day()) {
  get_sidebar();
} ?>

You’re done! Your sidebar will be displayed on all your blog pages except date-based archive pages.

Stéphane Kerwer
Article written by Stéphane Kerwer (1995 Posts)
Bonjour from a french guy. My name is Sté Kerwer and Dukeo is my blog. I do most of the heavy lifting in here but from time to time, you may see some guest posts. To receive updates from Dukeo, follow us on Twitter or like us on Facebook.
If you enjoyed this article, Get email updates
JOIN FOR FREE

Comments are closed.

Comments on "How To Hide Your WordPress Blog Sidebar On Date-Based Archive Pages" are currently closed. Check back later.