admin管理员组文章数量:1418637
I have custom post which prints some content in tabbed table, where only selected tab is visible.
Now, if print is selected, I would like to print contents of all the tabs. The problem is, that some content of these tabs is stored in post_meta, therefore I need to come up with different way of displaying the content for print and for usual displaying.
Is there a way to have single-custom.php
for displaying custom post and (say) single-custom-print.php
for printing it?
I have searched several print plugins and none of them do what I want them to do. If interested, here is example of the site in developement. Theme used: WP Travel
I have custom post which prints some content in tabbed table, where only selected tab is visible.
Now, if print is selected, I would like to print contents of all the tabs. The problem is, that some content of these tabs is stored in post_meta, therefore I need to come up with different way of displaying the content for print and for usual displaying.
Is there a way to have single-custom.php
for displaying custom post and (say) single-custom-print.php
for printing it?
I have searched several print plugins and none of them do what I want them to do. If interested, here is example of the site in developement. Theme used: WP Travel
Share Improve this question asked Jul 26, 2019 at 7:00 Pavel JanicekPavel Janicek 2123 silver badges14 bronze badges 1- Use css @media print. Open all tabs in print styles. – DenFunk Commented Jul 27, 2019 at 4:28
1 Answer
Reset to default 1You can add a custom CSS via the customizer (or via code). Chrome can also show you what your site will look like in print mode (see links at the bottom).
Something like the following would generate a nice page for printing:
@media print{
#custom-header{
background:#fff;
}
#custom-header > img,
a.scrollup, a.scrollup:visited,
.wp-travel-related-posts,
#footer-widgets{
display:none !important;
}
.resp-tabs-list {
display:none;
}
h2.resp-accordion{
display:block;
}
.tab-list-content{
display:block !important;
}
#colophon{
background:white;
color:#333;
}
#colophon a{
color:#333;
text-decoration:underline;
}
a:after{content:" (" attr(href) ") ";font-size:0.8em;font-weight:normal;}
}
Additional Reading:
- https://css-tricks/snippets/css/print-url-after-links/
- https://www.wpbeginner/plugins/how-to-easily-add-custom-css-to-your-wordpress-site/
- https://developers.google/web/tools/chrome-devtools/css/print-preview
本文标签: pdfCreate template for just a print
版权声明:本文标题:pdf - Create template for just a print 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745291934a2651848.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论