• What’s the easiest, dirtiest way to create a valid print.css file as it seems to be a requirement I think. I don’t want to edit the whole thing line by line just because someone who will never print it might some day print it out of the kindness of their heart.

    Please advise.

    Thanks in advance

Viewing 15 replies - 1 through 15 (of 20 total)
  • You basically should hide everything but the barebones content.

    #allofofstuffhere, #andhere, #andheretoo {
    display: none;
    }

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Jinsan, first print your page or pint-preview your page as it exists now. Most of the v1.5 themes (the Default, in particular) have a print.css-like function already built-in.

    Thread Starter jinsan

    (@jinsan)

    Macmanx could you exapnd on that, what do I do after a print preview? I don’t have a printer btw, never had a printer. I don’t print things…I feel so lonely…

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Well…. I’m not sure on a PC. On a Mac just go to Print and hit “Preview”. If you post your URL, I’ll take a look at it for you. Or, just email me your URL. (my email is listed on my site)

    It’s the same for PC. From your Browser menu > File > Print Preview is usually the form.

    Macmanx – you say that WordPress themes like Default, have print.css.-like functions built in. Where?

    I don’t see a print.css file in the default Theme folder. I ask this because I was told that I really didn’t need one by someone who “should know” because I had mentioned that I ALWAYS make my own to control the printed look as well as the visual. So I ignored it.

    I just validated my test site’s CSS and it borked on the print.css reference, bringing in PAGES and PAGES of stuff from the actual generated code and not a CSS reference in site. I’ve searched high and low and found no print.css in my WordPress 1.5 install.

    Is one there buried by default, or in the WordPress “machine” itself, or is mine missing from Default, or am I just a vicitim of someone’s over-active imagination and I need to create one anyway?

    None I could see in 1.5. I didn’t bring through the print.css from 1.2.2 to 1.5. I just deleted the reference to it from the upgraded index.php for my theme. Everything validates fine. I don’t see a problem in not having one. Who prints stuff anyway?

    Thread Starter jinsan

    (@jinsan)

    it’s not a matter of who prints mikep, but that it fits in with the whole validation thing. I simply removed the line where it requests a print.css and it validated the css. So no big deal in the end:)

    If you check your error logs everytime a page loads up and you have that line in there, it will look for it and add to your log.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    There is no print.css file with the Default theme, but go to blog running the Default theme (mine’s fine for that: http://www.macmanx.com/ ) and either print a page or print preview. The formatting looks exactly like it did under Kubrick using the print.css file. This leads me to believe that it’s actually hard-coded into the v1.5 template somewhere,

    Thread Starter jinsan

    (@jinsan)

    hmmm macmanx, thanks for the Email (just checked lol), it looks like hell print previewing via FF. But if anyone finds the hardcoded bit in Kubrick, perhaps make a post for it so it can be added to other templates.

    I wouldn’t say it looks like hell. It looks like all the CSS has been stripped. So without any knowledge about how WordPress works and if indeed they do have some kind of built in print.css, I’d say it looks like there is no css applied period. So if there is built in print.css file tucked in somewhere, all it does is strip all the code.

    For now, since a LOT of people print things out from my site all the time, including me, I will design a print.css file.

    Just more work…..

    Thread Starter jinsan

    (@jinsan)

    More work is the bit I try to avoid:)

    Sokrates

    (@sokrates)

    In the theme file header.php, an inline style definition (lines 17 to 48 in Kubrick) defines the layout images:

    <style type=”text/css” media=”screen”> code snipped </style>

    If the media is “print” (i.e. you are printing the page) this style is ignored, and you don’t get any graphics in the print.

    As suggested by Navid, including the following definition will hide the sidebar in the print(preview):
    <style type=”text/css” media=”print”>
    #sidebar {
    display: none;
    }
    </style>

    Does this help?

    Hi, I have been trying to make a printable version of my entire blog to give out to old ladies who don’t use computers. True.

    I want to make it easy to read but also attractive. I have been successful in tweaking the css in my header.php to change the width of the text column and the font etc.

    However, I’d like to include my masthead image in the print-out. But when I print, it is not there. I noticed the same thing happens for macmanx’s site too, <http://www.macmanx.com/wordpress/index.php&gt;
    when you try to print it out.

    Apart from the masthead image, everything else comes thru fine.

    Any ideas? my page is http://www.squatspace.com/bilateral

    @bilateral: The masthead isn’t included because it’s a background image. If you really really want to include it, you could move it from the stylesheet to the index.php (or header.php), but then you’d have to include the site title in the image (and put a link around the image) — or play around with position or layers… (always a bad/worse idea)

    bilateral, there’s two ways I can suggest handling this:

    1. Place the masthead image within a div in your template where you want it to appear, and assign the div a css class with the display: none; property in your regular (i.e. screen) stylesheet. You can also provide style properties to it in your print.css (for positioning and whatnot).

    2. Set up an explicit print template on your site (with the graphic), and link to that in all your posts. Fortunately such a template has already been done:

    http://www.lesterchan.net/portfolio/programming.php

    (Look for WordPress 1.5 Print.)

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Creating a print.css file’ is closed to new replies.