Print-Friendly Styles
Hides navigation, sidebars, comments and the admin bar when a page is printed, and prints link addresses after external links.
Opens WPIDE on
Code
@media print {
#wpadminbar,
.site-header nav,
.main-navigation,
.widget-area,
.sidebar,
.comments-area,
.site-footer nav,
.wp-block-navigation {
display: none !important;
}
body {
color: #000;
background: #fff;
}
.entry-content a[href^="http"]::after {
content: " (" attr(href) ")";
font-size: 90%;
}
}
Notes
Adjust the selectors to match the class names used by your theme.
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.