• Resolved hmfwic

    (@hmfwic)


    There is some great docs called Styling for Print that shows what to put in the style.css and header.php to make the printed output show up the way you want, BUT it doesn’t tell me what command I need to put in, and it doesn’t say what file it needs to be put in to make it work. ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • Create a stylesheet file called “printstyle.css” and stick it into your active theme directory. Then add this to your active theme header file, probably “header.php”:

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/printstyle.css" media="print,projection" />

    Thread Starter hmfwic

    (@hmfwic)

    BUT it doesn’t tell me what command I need to put in

    When reading a post, I want to see the word ‘Print’ at the bottom of the post. And when I click on the word ‘Print,’ I want the post to be printed, as in hard copy on my printer. That’s what I mean by my question above.

    and it doesn’t say what file it needs to be put in to make it work

    This question is still out there too.

    I may go with a print.css file like you suggest. Whether its a standalone file or just built into the style.css and header.php files I haven’t made up my mind. But whichever way I go, I need to know the syntax and/or command to use that will show me the option to print the post, AND, where to put it. Am I making any sense?

    The tip I sent you shows what you need to put in your HTML header to tell the clients browser which stylesheet it needs to use when printing. The tip assumes you will create a file called “printstyle.css”, with the relevant styling for paper instead of the screen. There is no “print this” involved, the user will simply press the print icon in the browser or select “file > print”. That’s it.

    While I think this is the preferred way to go, the other option is to (on top of that) offer some “print me” text type link or image, which when clicked will present a browser “print dialogue” to the user. How do you do that? With some embedded javascript.

    You’re obviously just starting out, so give yourself plenty of time to learn the basics. It’s very rewarding in the long term.

    Thread Starter hmfwic

    (@hmfwic)

    You’re obviously just starting out

    ?? ha, it shows. yes.. I am. Last time I wrote any kind of code was Basic and Turbo Pascal w/DOS. This ‘new’ stuff has passed me by I’m sorry to say.

    I’m beginning to understand how it will work, which is pretty cool. But will the code above tell the printer which post to print? I mean, what will print if the user is sitting on the main page, where there are 10 or more posts staring at him? How will it know which post to print?

    I understand that the print css file will handle the formatting and what NOT to print, like the sidebar and links and comments, etc.. but I want to be able to print a single post. Will the snippet above do that if the user hasn’t selected the post individually or must they do that before the code (above) will print just that single post?

    Thank you pizdin_dim for your patience with me. I’ll try it and see what happens.

    Try Gamerz WP-Print plugin. It can put a nice little icon or text link on your posts or pages.

    “But will the code above tell the printer which post to print?”

    The browser will print whatever is displayed on the screen, just marked up according to the rules in the “printstyle.css” file. To only offer a “print me” thingy on single posts, put the button code I suggested conditionally. If your theme has a “single.php” file, that’s where it should go.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘command to print a single post’ is closed to new replies.