Sunday, July 19, 2009

Embed Print Button to Your Blogger Posts

Embed Print Button to Your Blogger Posts
This tutorial helps you to add a Print button to your blogger posts. So lets get straight on with the tutorial.

Login into your Blogger Dashboard >Edit HTML
As I always say before attempting any tutorial or hack its wise to make a backup of your blogger template. So please download your blogger template.

Check the box "Expand Widgets Template" and then locate the code <p><data:post.body/></p> and replace it with the following code. Please note the code may vary without the <p> tag and if you have incorporated Read more hack please be careful and dont mess up your code.


<!--Printer Button hack chethstudios begins -->
<span class='noprint'><p><data:post.body/></p></span>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<a href='javascript:window.print()'>
<img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9nFo2K4WdHtqGDx8Rimj3r34lMHqhd-zCqA_qqAgblS5gGiCw8bKdhPmXU9aVCHFhkDiBfYUT-Fu1rs_uA2UYMVcWyOu_hoD3fxQwcRZUVa6DAlu5nr_-6HpW_4lqcZNOtcXOZuzMFDbI/'/></a></b:if>

<!-- Printer Button chethstudios ends -->


TWEAKS:

ADD a link instead of the printer icon. then paste this code instead of the above.


<!-- Printer Button hack chethstudios begins -->
<p><span class='noprint'><data:post.body/></p></span>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<a href='javascript:window.print()'>Print this post</a>
</b:if>
<!-- Printer Button hack chethstudios Ends -->


Now if you want the combination of the above two ie link with image. then paste the following instead of the above two.


<!-- Printer Button hack chethstudios begins -->
<span class='noprint'><p><data:post.body/></p></span>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<span style='background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9nFo2K4WdHtqGDx8Rimj3r34lMHqhd-zCqA_qqAgblS5gGiCw8bKdhPmXU9aVCHFhkDiBfYUT-Fu1rs_uA2UYMVcWyOu_hoD3fxQwcRZUVa6DAlu5nr_-6HpW_4lqcZNOtcXOZuzMFDbI/) left no-repeat; padding-left: 25px;'>
<a href='javascript:window.print()'>Print this post</a></span>
</b:if>
<!-- Printer Button hack chethstudios Ends -->


That's it! Feel free to ping me anytime if you get stuck up at any point.
You can also get a free subscription to Chethstudios updates. We will be back with more useful content. Get latest hacks and updates on your email

3 comments:

  1. Nice tutorial Cheth! Thanx for sharing! Will try out :)

    ReplyDelete
  2. Hi...I am to new at this...I will never get this set up and off the ground. I think I have something installed only to have it vanish. You have a lovely site.

    ReplyDelete
  3. I tried doing this on my blog but I can't find it when I was looking on the preview,. I tried pasting the first and third script. What did I do wrong? BTW, I replaced the tag.

    ReplyDelete

Please Don't Spam that's all. Grab our RSS Feed and we would Love to see you in our comments section more often.