Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Commit eb21080

Browse files
nielslangeianbelanger79
authored andcommitted
ADD #91: Add print.css (#97)
* #91: Add print.css * UPDATE #91: Improve print.css * UPDATE #91: Fix Travis CI issue * UPDATE #91: Fix Travis CI issue * UPDATE #91: Fix Travis CI issues * UPDATE #91: Move function call of print.css
1 parent a057abe commit eb21080

File tree

2 files changed

+165
-0
lines changed

2 files changed

+165
-0
lines changed

functions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ function twentytwenty_register_styles() {
200200
// Add output of Customizer settings as inline style.
201201
wp_add_inline_style( 'twentytwenty-style', twentytwenty_get_customizer_css( 'front-end' ) );
202202

203+
// Add print CSS.
204+
wp_enqueue_style( 'twentytwenty-print-style', get_template_directory_uri() . '/print.css', null, $theme_version, 'print' );
205+
203206
}
204207

205208
add_action( 'wp_enqueue_scripts', 'twentytwenty_register_styles' );

print.css

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
@charset "UTF-8";
2+
/*
3+
Theme Name: Twenty Twenty
4+
Adding print support. The print styles are based on the the great work of
5+
Andreas Hecht in https://www.jotform.com/blog/css-perfect-print-stylesheet-98272/.
6+
*/
7+
/*--------------------------------------------------------------
8+
>>> TABLE OF CONTENTS:
9+
----------------------------------------------------------------
10+
# Margins
11+
# Paddings
12+
# Width
13+
# Typography
14+
# Page breaks
15+
# Links
16+
# Visibility
17+
--------------------------------------------------------------*/
18+
@media print {
19+
20+
/* Margins */
21+
22+
@page {
23+
margin: 2cm;
24+
}
25+
26+
.entry-header,
27+
.site-footer {
28+
margin: 0;
29+
}
30+
31+
/* Paddings */
32+
33+
.posts {
34+
padding: 0;
35+
}
36+
37+
/* Width */
38+
39+
.entry-content,
40+
.entry-content p,
41+
.section-inner,
42+
.section-inner.max-percentage,
43+
.section-inner.medium,
44+
.section-inner.small,
45+
.section-inner.thin {
46+
max-width: 100%;
47+
width: 100%;
48+
}
49+
50+
/* Fonts */
51+
52+
body {
53+
background: #fff !important;
54+
color: #000;
55+
font: 13pt Georgia, "Times New Roman", Times, serif;
56+
line-height: 1.3;
57+
}
58+
59+
h1 {
60+
font-size: 20pt;
61+
}
62+
63+
h2,
64+
h2.entry-title,
65+
h3,
66+
h4,
67+
.has-regular-font-size,
68+
.has-large-font-size,
69+
.comments-header {
70+
font-size: 14pt;
71+
margin-top: 1cm;
72+
}
73+
74+
/* Page breaks */
75+
76+
a {
77+
page-break-inside: avoid;
78+
}
79+
80+
blockquote {
81+
page-break-inside: avoid;
82+
}
83+
84+
h1,
85+
h2,
86+
h3,
87+
h4,
88+
h5,
89+
h6 {
90+
page-break-after: avoid;
91+
page-break-inside: avoid;
92+
}
93+
94+
img {
95+
page-break-inside: avoid;
96+
page-break-after: avoid;
97+
}
98+
99+
table,
100+
pre {
101+
page-break-inside: avoid;
102+
}
103+
104+
ul,
105+
ol,
106+
dl {
107+
page-break-before: avoid;
108+
}
109+
110+
/* Links */
111+
112+
a:link,
113+
a:visited,
114+
a {
115+
background: transparent;
116+
font-weight: bold;
117+
text-decoration: underline;
118+
}
119+
120+
a {
121+
page-break-inside: avoid;
122+
}
123+
124+
a[href^="http"]:after {
125+
content: " < " attr(href) "> ";
126+
}
127+
128+
a:after > img {
129+
content: "";
130+
}
131+
132+
article a[href^="#"]:after {
133+
content: "";
134+
}
135+
136+
a:not(:local-link):after {
137+
content: " < " attr(href) "> ";
138+
}
139+
140+
/* Visibility */
141+
142+
#site-header,
143+
.comment-form,
144+
.comments-wrapper,
145+
.comment .comment-metadata,
146+
.footer-social-wrapper,
147+
.footer-widgets-outer-wrapper,
148+
.header-navigation-wrapper,
149+
.pagination-wrapper,
150+
.post-meta-wrapper.post-meta-single-bottom
151+
.post-separator,
152+
.site-logo img {
153+
display: none;
154+
}
155+
156+
.entry-content .wp-block-button .wp-block-button__link,
157+
.entry-content .wp-block-button .wp-block-file__button,
158+
.entry-content .button {
159+
background: none;
160+
color: #000;
161+
}
162+
}

0 commit comments

Comments
 (0)