Make WordPress Print Pretty

Making your WordPress site print-friendly is probably not the first thing on your GTD list. However, the process is relatively straightforward. The simplest method is editing your existing header.php and style.css files.

First, look for the HTML declaration in your theme’s main file, usually header.php. Search for something like this:

<link rel="stylesheet" 
href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

Change the last attribute to:

media="screen, print"

Second, it’s time to edit your theme’s CSS file, usually style.css. Add the following code to the bottom of the stylesheet:

@media print and (color) {
* {
     -webkit-print-color-adjust: exact;
     print-color-adjust: exact;
  }
}

That’s it! If you have caching enabled, remember to empty your cache. Happy printing.

Leave a Reply