How To Add Print Button In WordPress Posts

Adding a Print Button in WordPress posts might be a good idea or a bad idea depending on what type of website you are running.

If you want your visitors to read your content only by visiting your website then adding a print button might be a bad idea. But if you blog about tutorials or how-to guides then providing a print button for your visitors might be a very good idea.

Visitors to a tutorial site or how-to site would love to print a post and follow it instead of carrying their computer, phone or tablet everywhere with them. So adding a Print Button in WordPress posts can be a good practice.

I will provide the Print Button Code in this post. All you have to do is insert this code inside the Single.php (Single Post) file of your current WordPress theme.

There are two parts in this post:

  1. First is a simple ‘Print This ArticleLink.
  2. And second part is Print Button.

So lets see how to add a “print this article” Link and Print Button in WordPress posts –

[sws_toggle1 title=”Print This Article Code – Click Here  “] <a href=”javascript:window.print()”>Print this Article</a> [/sws_toggle1]

I have tested this code on Twenty Eleven theme in WordPress. And it should work in your theme as well. Refer to the image below and follow these steps –

print this article link in wordpress post

  • 1) Open Administrators Dashboard > Appearance > Editor > Single.php
  • Add the given Print Code wherever you want it to appear.
  • I have added it just above the comments_template.
  • 2) Update File.
  • 3) Visit any post on your Blog, You can see ‘Print this Article’ Link at the end of the post.
  • The link appears after the content and before the comments.

But this just adds a Link instead of a Button. To add a button we will modify the code and add a image somewhere between there.

[sws_toggle1 title=”Print Button Code – Click Here”]

<a href=”javascript:window.print()”>

<img src=”×32/print.png” />



In Print Button Code, i have added a Print Icon Image. You can replace that image with any image icon you want. Just Google the image you want to use and replace the image link with your desired image link. Or else you can use the code as it is !

Follow the same steps to add the new code which will help you to add a Print Button to your wordpress theme. After adding the print button, it would look like this:

print button in wordpress post


Adjusting Position of Print Button in WordPress Post

The Print Button might or might not appear in correct position because it depends on your theme. So if you don’t like the current position of the Print Button in WordPress posts then you can go ahead and add inline style to it.

The print button appears to the extreme left side in Twenty Eleven theme. So i will add margin-left style to it and push it rightwards. I will add about 150px left margin, so it will be moved to right side by 150 pixels. Check the code given below.

[sws_toggle1 title=”Print Button with Positioning – Click Here”]

<span style=”margin-left:150px;”>

<a href=”javascript:window.print()”>

<img src=”×32/print.png” />




If you replace the Print Button code with the new Print Button with Positioning Code then you will get the following result –

position of print button in wordpress posts

And thus you can adjust the position of Print Button in WordPress posts by changing the value of margin-left attribute. If you have any questions feel free to comment below. Thanks for reading. And subscribe to blog feed if you like this post !

How To Add Dynamic Meta Description to WordPress

This post is all about adding a Dynamic Meta Description to your WordPress Theme. You can try and add meta description code in the header.php file of your WordPress theme. But it would result into a static meta description. Which means the meta description will remain the same for each and every page on your WordPress site.

But if you want to tweak and optimize your site for search engines then you must add dynamic meta description to your WordPress Theme.

This can help you to have different meta descriptions for your home page, static pages, and blog posts. Also this can help you improve the SEO of your site.

First of all, I don’t know if you have any idea of what is a Meta Description. So i will write few more lines about it before we actually get to the Dynamic Meta Description part.

What is Meta Description?

Meta Description of a page is like a very brief and concise information of what the page is all about. It is not a major factor in determining the search engine rank. But it can surely help you to get good search engine rank for your website.

wordpress dynamic meta description for home pageIn the image above, you can see the green text is what Meta Description looks like in Google Search Results. Now lets see how to add a Meta Description to WordPress Theme.

Adding Static Meta Description To WordPress Theme

We’re going to add a simple meta description to header.php of WordPress Theme. To do so, follow the steps given below –

  • 1) Open Administrators Dashboard > Appearance > Editor > header.php
  • 2) Add the following Code just before the closing head tag ( </head> )

  • 3) Replace Blog Description Goes Here with your Blog Description Text.
  • 4) Update file. And you’re done.

But since header.php is loaded on every page of your WordPress site, the meta description will remain the same on every page of your site. Which means it is a Static Meta Description.

Adding Dynamic Meta Description To WordPress Theme

Lets see  how to add a dynamic meta description to the WordPress Theme. The basic concept is that we are going to use if else code to detect which page is being loaded. And with that information we can then determine an appropriate or dynamic meta description for that respective page.

  • 1) Open Administrators Dashboard > Appearance > Editor > header.php
  • 2) Add the following Code just before the closing head tag ( </head> )

  • 3) Replace Blog Description Goes Here with your Blog Description Text.
  • 4) Update file. And you’re done.

This code helps you to show a Static Meta Description for Home Page as well as Front Page of your WordPress site. But it will generate a dynamic meta description for all your WordPress posts.

The first part of the code checks that if page is home page or front page then display Blog Description. While the second part of the code checks whether the page is a single post page, and if so then use an excerpt of the post as Meta Description.

Now the Meta Description is different for home page as well as for every blog post. And thus we have successfully implemented a Dynamic Meta Description in a WordPress theme.

How To Access Startup Folder in Windows

This is a very short and basic post about how to access startup folder in windows – the easy way.

Normally we access startup folder either by:

1) Opening start menu, then clicking all programs and finally selecting startup folder.
2) Searching for startup folder directly using file explorer.
3) Or navigating to the startup folder manually.

But in this post i am going to share two short shell code or commands which will help you to access startup folder in about 5 to 10 seconds.  All you need to do is put these commands inside command prompt, the run dialog box, or directly by opening start menu in Windows 7 or the Metro UI in Windows 8.

Default Directory

Before that, I would like to share the default directory of Startup Folder for ‘All Users’

1) Windows XP

C:Document and SettingsAll UsersStart MenuProgramsStartup

2) Windows 7 and Windows 8

C:ProgramDataMicrosoftWindowsStart MenuProgramsStartUp

Shell Commands

These are the shell commands which i have tested in Windows 8:

To access startup folder of All Users: shell:common startup

To access startup folder of current logged in user: shell:startup

access startup folder using shell common startup

As i said previously, You can enter these commands in Command Prompt, Start Menu (Windows 7), or Metro UI (Windows 8). So i hope this helps. I am not sure if these work in Windows XP. But if you give it a try, then please let me know the results in comments below. Thanks for reading.