Web Masters Site All For Web Masters

16May/100

How to Automatically Create Bit.ly Links for Blog Posts

URL Shortner services used to trim down your long urls to a short and easy to share links. This code will automatically generate Bit.ly short links for your blog posts for easy to share on Twitter and IMs.
Open functions.php file of your theme and add the following code:

function bitlyLink($url) {
 
$username = "Bit.ly Username"; // Your Bit.ly Username
$api = "Bit.ly API Key"; // Your Bit.ly API Key
 
$data = file_get_contents("http://api.bit.ly/shorten?version=2.0.1&format=xml&longUrl=".$url."&login=".$username."&apiKey=".$api);
 
$xml = new SimpleXMLElement($data);
$shortlink = $xml->results->nodeKeyVal->shortUrl;
 
return $shortlink;
}

Don’t forget to add your Bit.ly Username and API key (get API key)

Now add the following code within loop in single.php file of your theme.

<?php
$bitlyLink = bitlyLink(get_permalink($post->ID));
echo 'Short Link for this post: <a href="'.$bitlyLink.'">'.$bitlyLink.'</a>'
?>

P.S. All the links will generate within your account so you can track them all by logging in to your Bit.ly account.

Open functions.php file of your theme and add the following code:

01 function bitlyLink($url) {
02
03 $username = "Bit.ly Username"; // Your Bit.ly Username
04 $api = "Bit.ly API Key"; // Your Bit.ly API Key
05
06 $data = file_get_contents("http://api.bit.ly/shorten?version=2.0.1&format=xml&longUrl=".$url."&login=".$username."&apiKey=".$api);
07
08 $xml = new SimpleXMLElement($data);
09 $shortlink = $xml->results->nodeKeyVal->shortUrl;
10
11 return $shortlink;
12 }

Don’t forget to add your Bit.ly Username and API key (get API key)

Now add the following code within loop in single.php file of your theme.

1 <?php
2 $bitlyLink = bitlyLink(get_permalink($post->ID));
3 echo 'Short Link for this post: <a href="'.$bitlyLink.'">'.$bitlyLink.'</a>'
4 ?>

P.S. All the links will generate within your account so you can track them all by logging in to your Bit.ly account.

Filed under: Wordpress No Comments
11Jul/090

Top 10 Most Popular WordPress plugins

Most Popular WordPress plugins

Most Popular WordPress plugins

A list of most popular wordpress plugins which are in internet today. Take a look

1# All in One SEO Pack

Yap one of the most popular plugin for wordpress, that's because it is not enough to create blog second thing is to get traffic, this plugin will help you to get traffic from search engines and optimize your blog for search engines, this plugin will automatically optimizes your WordPress blog for Search Engines.

Download All in One SEO Pack

#2 Google XML Sitemaps

This plugin will create Google Sitemap for your blog, which will help to google bot to crow your site more easy and so more quickly, so this is important plugin too.

Download Google XML Sitemaps

#3 Sociable

Automatically add links to your favorite social bookmarking sites on your posts, pages and in your RSS feed. You can choose from 99 different social bookmarking sites! Nice plugin...

Download Sociable

#4 Contact Form 7

Contact Form 7 can manage multiple contact forms, plus you can customize the form and the mail contents flexibly with simple markup. The form supports Ajax-powered submitting, CAPTCHA, Akismet spam filtering and so on.

Download Contact Form 7

#5 NextGEN Gallery

NextGEN Gallery is a full integrated Image Gallery plugin for WordPress with a Flash slideshow option. Before I start writing the plugin I study all photo and picture plugins for WordPress, I figure out that some of them are really good and well designed, but I missed a simple and easy administration back end to handle multiple photos, galleries and albums.

Download NextGEN Gallery

#6 Google Analytics for WordPress

The Google Analytics for WordPress plugin automatically tracks and segments all outbound links from within posts, comment author links, links within comments, blogroll links and downloads. It also allows you to track AdSense clicks, add extra search engines, track image search queries and it will even work together with Urchin.

Download Google Analytics for WordPress

#7 WordPress.com Stats

There are hundreds of plugins and services which can provide statistics about your visitors. However I found that even though something like Google Analytics provides an incredible depth of information, it can be overwhelming and doesn't really highlight what's most interesting to me as a writer. That's why Automattic created its own stats system, to focus on just the most popular metrics a blogger wants to track and provide them in a clear and concise interface.

Download WordPress.com Stats

#8 Akismet

Akismet checks your comments against the Akismet web service to see if they look like spam or not and lets you review the spam it catches under your blog's "Comments" admin screen.

Download Akismet

#9 Page Flip Image Gallery

Do you need to show your photos to the best advantage and post them in a speedy manner, don't you? You need to make a bright and memorable presentation, portfolio or image gallery? This plugin will help you!!

Download Page Flip Image Gallery

#10 Plugin Manager

Last plugin which lets you to view, download and install plugins from wordpress.org from an AJAX'ed interface, instead of manually downloading, extracting and uploading each plugin.

Download Plugin Manager

Filed under: Wordpress No Comments