This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Print page code

  • Creator
    Topic
  • #2071
    Lars
    Participant

    I want to make buttons wich prints the page. Is there a WordPress or theme specific code for this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #2080
    Jason Bobich
    Keymaster

    You’d need to get some sort of plugin. I think if you search over in the Plugin repo, you can find a lot of free things you could try.

    http://wordpress.org/extend/plugins/search.php?q=print

    #2081
    karlo
    Participant

    I have had some success with http://wordpress.org/extend/plugins/wp-print-friendly/ with another theme but in the end I did it myself based on Print code from HTML5Boilerplate https://github.com/h5bp/html5-boilerplate/blob/master/css/main.css#L230 And last week i ripped out a similar snippet from I dont know where. Preparation for jumpstart printing. Cant be bothered to test as it is no fun. Like you I will need to make own “template”.

    /* =Print media= 
    		------------------------------------------------- */
    @media print {
    
    	* {
    		color: black            !important;
    		background: transparent !important;
    		text-shadow: none       !important;
    		box-shadow: none        !important;
    		border: none            !important;
    		float: none             !important;
    		clear: none             !important;
    		}
    	html, body, article, header, section, footer, aside, div { width: 100% !important; }
    	a, a:link, a:visited, a:hover, a:active, abbr, acronym {
    		text-decoration: none;
    		border-bottom: 0 none; }
    	h1, h2, h3, h4, h5, h6, p, li {
    		page-break-inside: avoid;
    		orphans: 3; widows: 3; }
    	h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
    	thead   { display: table-header-group; }
    	tr, img { page-break-inside: avoid; }
    	nav     { display: none; }
    
    }

    I dont think Bootstrap has any.

    So simply a media query but not CSS3, goes way back http://blogs.msdn.com/b/ie/archive/2005/06/10/428149.aspx Way better method than external CSS file http://www.phpied.com/5-years-later-print-css-still-sucks/ – but also painful to set up. Takes some time to tear down pages – and test over and over. Print preview is ok but you really need real print to be sure.

    • This reply was modified 7 years, 11 months ago by karlo.
    • This reply was modified 7 years, 11 months ago by karlo.
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.