ADD “EMAIL THIS ARTICLE TO A FRIEND” INTO YOUR WORDPRESS SITE WITHOUT USING A PLUGIN

0 48

As we created interesting posts in our site and which are worth of sharing into our friends, we open use other functionality so that user can share, send posts to their friends, other sites owner are adding social sites to share and send post to their friends and followers but this time I will try to explain how to create Email This Article to Friend without using a plugin and or social sites.

Note:
In this tutorial we need to edit single.php file in our current theme as the Send button only display in single post.Okay, let’s start.

PHP

This contains small information use to send email, like Post title, Post content and post URL. This snippet should put before the HTML form.

HTML

This contains our HTML form for sending data.

Javascript

This contain JS script for popup HTML or simply a dialog box form and send data to the server.

Confused?

Okay I will explain how the above javascripts works.

  • tuts("#show-form"): We simply add an event and display the form if #show-form is triggered.
  • tuts("#hide-form"): This will use to hide the form.
  • tuts.post(): We’re using jQuery.post to send data(s) to the server, visit jQuery site for more information.

ajax-email.php

This contains PHP script that accepts data that are being sent from javascript above.

CSS

To beautify our send button and form we need to add CSS code, copy and paste below code to apply.

That’s it, this tutorial is quite long but it contains everything you need ;), you can share your idea below.

You might also like More from author

Leave A Reply

Your email address will not be published.