1

How do I properly link a print style sheet? All my styles have been enqueued through functions file.

The codex suggested I put the link in the header but this didn't work, is there a core print stylesheet?

I tried to create a link in the header but I see any of these styles? I do see the print.css file in the header when I look at the source.

/css/print.css" type="text/css" media="print" />

1 Answer 1

5

Use wp_enqueue_style to add a print stylesheet, note the media parameter that lets you make it a print-specific stylesheet:

function wpa_print_styles(){
    wp_enqueue_style(
        'wpa-print-style', 
        get_stylesheet_directory_uri() . '/print-style.css', 
        array(), 
        '20130821', 
        'print' // print styles only
    );
}
add_action( 'wp_enqueue_scripts', 'wpa_print_styles' );
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.