Easily Add Custom Header, Footer, or Sidebar for Each Category – WPSaviour

By WP Saviour •  Updated: 12/05/20 •  1 min read

Did you ever see WordPress blogs which have a separate header for various classes? On this tutorial we’ll share a easy snippet that you need to use so as to add customized header, footer, and even sidebar for every WordPress class.

To name a specific header, you will want to open your index.php and change your regular header code with this one:

This code above is mainly telling WordPress that if somebody opens the class referred to as “Running a blog” then WordPress must show a file referred to as header-blogging.php if it exist. If it doesn’t exist, or if the class shouldn’t be running a blog, then WordPress shows the default header file.

To get a separate sidebar for every all you must do is add the next code:

The code above will search for sidebar-blogging.php to exchange the default footer file if the class is Running a blog.

To get a separate footer for every class all you must do is add the next code:

The code above will search for footer-blogging.php to exchange the default footer file if the class is Running a blog.

gp-2648078 as-9145224

WP Saviour

I am a WordPress specialist. My mission is to help you create beautiful websites with ease!