I have a page which has 2 css in the header:
<link type="text/css" rel="stylesheet" href=<?= $theme_url ?>/css/page-kitchen.css">
<link type="text/css" rel="stylesheet" href=<?= $theme_url ?>/css/page-kitchen.css" media="print">
and 2 script file:
<script type="text/javascript" src="<?= $theme_url ?>/js/jquery.min.js"></script>
<script type="text/javascript" src="<?= $theme_url ?>/js/kitchen.js"></script>
And I have a print <img>
tag which calls onclick
the print event:
<img src="<?= $site_url ?>/wp-content/uploads/printer.png" alt="Print page" onclick="printDiv('#body-print');" style="cursor: pointer; width: 5%; height: 5%;"></img>
which print's the page #body-div
content.
It opens the printer page but doesn't add the default css files. Here is my js file:
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
I've tried to append the css file but can't made too far. Checked this and this solutions from the site but none of them worked for me.