So most of you are aware of the recent gadget added to blogger widget directory and that is a small contact form with two input fields for name and Email and a text area for writing the message. We use a complex PHP Form for our contact page but blogger has made it extremely easy for you guys. Ever wondered how to customize this simple form into a professional looking contact form that may give a complete new boost to your overall blog look? Fortunately all MBT readers will be the first to learn this trick today. Plus you will also learn how to add this form anywhere on your blog! I had sometime today so I designed a custom version of this contact form by adding several new CSS3 effects and also added an additional button called "Clear" that will reset and erase the message for your visitors if incase they wish to rewrite a new message. Kindly view the Demo below:
Note: We have added the contact Form to a static page and also the sidebar. Just to show that you can add this Custom Form anywhere you want. On static page the Form on sidebar wont display but it will display on all other pages.
- Read Part2: Create a Custom contact Form For blogger!
Tutorial Guide:
We have divided this tutorial in 4 parts:
- Adding the Normal Contact form widget to sidebar
- Controlling Widget Display
- Customize the Contact Form
- Finally Add the Customized contact Form to Sidebar, Post or Static Page
1. Adding contact Form to Sidebar:
By default blogger will allow you to add this widget to your sidebar only but you can easily embed its code on any post or static page easily by copying the HTML code by viewing the browser source file (Ctrl + U). I have taken all the headache so you will only need to follow these easy steps below:
- Go to blogger > Layout
- Click Add a gadget
- Next click on "More Gadgets" and then choose the first widget as shown below:
4. Now you have successfully added or in other words registered your contact form widget with blogger.
5. Don't Remove this gadget and leave it intact. If you tried to ever remove it then the Customized contact form that we will code wont work. We will surely Hide this widget from sidebar.
2. Controlling Widget Display
The contact form that you created has an ID #ContactForm1 , using this ID you can easily locate the HTML code of the normal form in your blog source file. Well we have already done all the work so you simply need to follow these easy steps:
Hide The Normal Form on sidebar
- Go To Blogger > Template
- Backup your template
- Click Edit HTML
- Search for </head>
- Just above it paste the following conditional statement that will hide the widget on sidebar:
<b:if cond='data:blog.pageType == "static_page"'>
<style>
#ContactForm1{ display:none!important;}
</style>
</b:if>
The above code will hide the Normal Contact Form on a Static Page only. If incase you wish to add the Custom contact Form to a Post then you may use the following code instead:
<b:if cond='data:blog.url == "URL OF Selected Post"'>
<style>
#ContactForm1{ display:none!important;}
</style>
</b:if>
Replace URL OF Selected Post with the URL of the Post where you will add the contact form.
In our DEMO we have added the contact form to a static page therefore we have used the first code in step#5.
3. Customizing The Contact Form - The Fun Part!
To Keep the tutorial easy, this part will be discussed in Part2 of the tutorial.
- Read Part2: Create a Custom contact Form For blogger!
Share your views below and stay tuned for the amazing tricks coming tomorrow! Peace and blessings buddies :)