Print the Page Address and Date on Printouts
Adds a line with the page's web address and the print date at the bottom of printed pages, so paper copies can always be traced back to the original.
Opens WPIDE on
Code
<style>
.wpide-print-source{display:none;}
@media print{.wpide-print-source{display:block;margin-top:2em;padding-top:.6em;border-top:1px solid #999;font-size:10pt;color:#333;}}
</style>
<script>
window.addEventListener('beforeprint', function () {
var note = document.querySelector('.wpide-print-source');
if (!note) {
note = document.createElement('p');
note.className = 'wpide-print-source';
document.body.appendChild(note);
}
note.textContent = 'Source: ' + window.location.href.split('#')[0] + ' \u2014 printed ' + new Date().toLocaleDateString();
});
</script>
Notes
Only visible on paper or PDF exports; nothing changes on screen.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.