26 May 2017

How to Use Shortcode in your WordPress Sidebar Widgets (Text)

Just Add the following short code in your theme function.php
// Enable shortcodes in text widgets
add_filter('widget_text','do_shortcode');
Now check it ...


Don’t auto-p wrap shortcodes that stand alone use this like same
add_filter( 'widget_text', 'shortcode_unautop'); 

13 Sept 2016

How Capture Left, Right and Middle Mouse Click with jQuery

$('body').mousedown(function(event) {
    switch (event.which) {
        case 1:
            alert('Left Mouse button clicked.');
            break;
        case 2:
            alert('Middle Mouse button clicked.');
            break;
        case 3:
            alert('Right Mouse button clicked.');
            break;
        default:
            alert('You have a strange Mouse!');
    }
});





Reference:
http://api.jquery.com/event.which/
http://www.w3schools.com/jsref/event_button.asp
http://stackoverflow.com/questions/1206203/how-to-distinguish-between-left-and-right-mouse-click-with-jquery

25 Feb 2016

One Gmail Account = Multiple Test Email Addresses


Don't know about you but a lot of what I do requires having access to multiple email addresses (testing websites that require signup etc). To aide my development I have a few email accounts I use - a Gmail, a Hotmail, a Yahoo and a Google Apps one (my main account). That's only four addresses though, which can be quite limiting at times.
In steps Gmail. If you have a Gmail account then you have access to "infinite" email addresses using that one account.
The Gmail account I use for general testing is:
myname@gmail.com (I left a t off on purpose)
But I could also use any of the following:
myname+1@gmail.com

myname+2@gmail.com

myname+3@gmail.com

myname+123456789@gmail.com, etc etc,.

You get the idea. You can tack a + sign and then any random string after it to invent a new email address. Obviously it still delivers to your Gmail account and it lets you signup to a website over and over as a "different" user.


17 Feb 2016

Simple PHP pagination example using MySql database

<?php
$num_rec_per_page=10;
mysql_connect('localhost','root','');
mysql_select_db('apex1');
if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$sql = "SELECT * FROM student LIMIT $start_from, $num_rec_per_page";
$rs_result = mysql_query ($sql); //run the query
?>
<table>
<tr><td>Name</td><td>Phone</td></tr>
<?php
while ($row = mysql_fetch_assoc($rs_result)) {
?>
            <tr>
            <td><?php echo $row['Name']; ?></td>
            <td><?php echo $row['Phone']; ?></td>          
            </tr>
<?php
};
?>
</table>
<?php
$sql = "SELECT * FROM student";
$rs_result = mysql_query($sql); //run the query
$total_records = mysql_num_rows($rs_result);  //count number of records
$total_pages = ceil($total_records / $num_rec_per_page);

echo "<a href='pagination.php?page=1'>".'|<'."</a> "; // Goto 1st page

for ($i=1; $i<=$total_pages; $i++) {
            echo "<a href='pagination.php?page=".$i."'>".$i."</a> ";
};
echo "<a href='pagination.php?page=$total_pages'>".'>|'."</a> "; // Goto last page
?>

28 Jan 2016

Meet DUTA Completely Free Of Cost WhatsApp Based Service


Everyone uses WhatsApp but only as a messenger or having fun like jokes etc. Some peoples also use WhatsApp for their work. Today We are sharing a WhatsApp based service. You can get updates like news,cricket scores and bollywood etc. And main thing about DUTA is that's completely free of cost.
Steps to activate DUTA on WhatsApp ---


1. First save both mobile no. as contacts in your smartphone +919841916290 and +919841918127 give name DUTA to both contacts
2. Add both contacts in your WhatsApp group if you are not admin then ask admin to add both contacts in group
3. After adding the both contacts in group you have activated DUTA on your WhatsApp
Now active DUTA channels which you want --

Bible channel -- Now get daily psalm from the Bible along with malayalam, tamil, hindi & english translations in your WhatsApp group. To subscribe type +Bible. To unsubscribe type -Bible.

Cricket channel -- Get live score updates of Indian cricket matches on your WhatsApp group. To subscribe cricket channel just type +Cricket. To unsubscribe type -Cricket.

News channel -- Get news updates in every 3 hours from 9:30AM to 9:30PM. To subscribe news channel type +News. To unsubscribe type  -News. To get News in Hindi type +Samachar. To unsubscribe Hindi News channel type -Samachar.

Stock Market channel -- Get updates on market stock prices twice everyday. To subscribe type +Finance. To unsubscribe type -Finance.

DUTA offers even more services --
1. Currency -- Now, you can get the current prices for any Currency in your WhatsApp group. Send *Finance <currency amount> (for example *Finance $10) to the group.
2. Commodity -- Get the current price for any commodity! Send *Finance <commodity name> (for example *Finance silver) to the group.
3. Stock -- Now, you can check the stock price of all your Stocks in your WhatsApp™ group. Send *Finance <company name> (for example *Finance HDFC) to the group.
4. General Knowledge -- Now, you can play Quiz anytime along with your friends in your WhatsApp group. Send +GK and quiz will begin within 2 minutes.
5. Weather -- Now, you can get the Weather report for your locality anytime, anywhere in your WhatsApp group. Send *weather <pincode> ( example *weather 110067 to the group.
6. Train Status -- Now, you can get the status of any train, anytime in your WhatsApp group. Send *Train<train number> (example *train 12780) to the group.
7. PNR Status -- Check PNR status in WhatsApp group. Send *PNR<pnr number> ( example *PNR 6737385679 ) to the group.
8. Dictionary -- You can check the meaning of the words in your WhatsApp group. Send *Dict <word> (example *Dict ahead ) to the group.
9. Daily Horoscope -- Now find out how your day is going to be in the comfort of your WhatsApp group using duta's daily horoscope prediction. Send *Astro<date> ( example *Astro dd-mm-yyyy ) to the group.
10. Trivia -- Now you can play, along with friends and family, fun Trivia challenges DAILY anytime, anywhere in your WhatsApp group. Send *Trivia in your group and trivia quiz will begin within one to two minutes.
Get even more info about DUTA by sending *info in your group or visit duta.in