Tag Archives: WordPress

Easy Retweet plugin now supports Google Analytics tracking

I recently released a couple of updates to my Easy Retweet WordPress Plugin.

For those who don’t know, Easy Retweet WordPress Plugin allows you to Twitter tweet or bit.ly buttons to your WordPress posts.

You can choose to add these buttons using any one of the following ways

  • Automatic way – Just configure the button in the settings screen
  • Using shortcodes
  • Using template functions

Google Analytics tracking

One of the new feature that I have added to the Plugin is the ability to add Google Analytics tracking to links that are tweeted using the Tweet buttons.

You can add Google Analytics tracking by including the following in the url that gets tweeted.

  • utm-campaign
  • utm-source
  • utm-medium


In addition to the new features, I have also added translations for the following languages

  • Danish
  • Irish
  • Hindi
  • Romanian

Mandatory update

The current version of the Plugin is 3.0.1 and it includes both new features and bug fixes. So it is a mandatory update. You can install it from your WordPress admin or download it from the Plugin homepage.

Posted in WordPress | Tagged , , , | Leave a comment

Creating new pages in WordPress through code

Recently, I had to create a new page automatically in WordPress, when a Plugin was created.

I thought there will be a simple core function like wp_insert_post which I can use. It turned out that create a new page from code is not that easy in WordPress. I ended up creating a new function myself wrapping the call to wp_insert_post.

I thought of posting it here so that I know where to look when I need it again :)

So here is the function.

It takes 5 parameters, out of which only one is mandatory.

  • $title – The title of the post (mandatory)
  • $content – The content of the post
  • $parent – The post id of the parent page. If this is the top level page, then pass 0
  • $page_template – The page template to use for this page
  • $menu_order – The menu order field.

While you are at it, you might also want to find out whether the page with that title already exists, before creating a new one.

Posted in WordPress | Tagged , | 1 Comment

Developing WordPress Plugins in Github

As most of you know, I actively develop and main more than 20 WordPress Plugins. All of them are hosted in the official WordPress Plugin repository.

Until recently I was using the official WordPress repository’s svn to do the development. All my non-WordPress pet projects are hosted in my github account.

I was thinking of moving all my WordPress Plugins to github for quite sometime now, but didn’t do it thinking that it might involve huge effort to keep both the repos in sync.

After reading about how a couple of people moved (and didn’t face much problem afterwards), I decided to try it out for a couple of my Plugins. The following is what I did and in the end, figured out that it was worth the effort.

Github – more than just code

To be fair to official WordPress Plugin repository, there is nothing anything wrong with the way it works or with svn.

It is just that github as a platform is more suited if you are interested in collaboration and receiving contributions from users. It reduces the barrier to entry for people to contribute to projects and also it provides enough tools for project owners to easily merge (or reject) contributions from users.

I was more interested in this aspect of github rather than the ‘git’ part.

Using github for hosting WordPress Plugins

When I decided to move from svn to github, I wanted to do the following things.

  • I wanted to maintain the entire check-in history from svn. Some of my Plugins are more than 4 years old and have gone through lot of revisions and I didn’t wanted to loose them.
  • I also wanted to do the development in github (read doing atomic check-ins) and then upload to WordPress repository only when I tag the changes for release after testing them.
  • I also didn’t wanted to manually check-in in both the places to do the sync.

For the first I found that git-svn can fetch all the check-in history.

For the second and third point, keeping pragmatism in mind, I ended up creating shell scripts so that I don’t have to do anything manual.

Automation scripts

You can get the scripts that I wrote from my github account. The project consists of two scripts.

  • clone-from-svn-to-git.sh – Use this script to clone your WordPress Plugins from SVN into git/github
  • deploy-plugin.sh – Use this script to push your WordPress Plugin updates to SVN from gi/github

Right now the documentation is pretty sparse. I will fix it when I get some free time :)

Things to improve

The scripts pretty much do the job. Going forward, I want to improve the following to make it more useful.

  • The readme.txt file used by WordPress repository is not fully in markdown. Because of which the readme file displayed in github is slightly broken.
  • Ability to auto update the .pot file before releasing the new version
  • WordPress repository allows you to add a banner using the assests/ directory. Need to add support for that.

Update: All the above features are added. Check out the latest code in github.

Is it worth the effort?

So far I have moved the following Plugins to github. Will be moving the other ones as well when even I get some free time.

So now the real question. Is it worth the effort? It is worth every second that I spent on it.

You should check the pull requests I have received so far. I have received more contributions to my Plugins in the last couple of weeks than the last 5 years :)

If you are a WordPress Plugin developer, then try out my script and let me know if you have any feedback.

Posted in WordPress | Tagged , , , , | 8 Comments

Completely rewrote WP-IRC Plugin

It’s been quite sometime since I released my WP-IRC WordPress Plugin. A couple of users complained about the increase in page load time and so I decided to fix it and ultimately ended up rewriting it.

By the way if you have not used it before, WP-IRC is a WordPress Plugin, that retrieves the number of users who are currently online in an irc channels and allows you to display this information in the sidebar using widgets.

Dynamic update using AJAX to decrease page load time

Since the Plugin has to connect to the irc server through sockets and do some protocol exchange to retrieve the user count in a channel, it was increasing the page load time drastically and was the major complaint that I was receiving about the Plugin.

I tired to decrease the page load time by lazily connecting to the irc server after the page is loaded using AJAX to retrieve the user count. This has drastically decreased the page load time and was one of the highlight of this rewrite.

You can check out this excellent article to find out how to use AJAX in WordPress.

Added caching to decrease page load time

In addition to using AJAX, I have also implemented caching so that the Plugin doesn’t have to connect to the irc server for every page load to retrieve the user count.

I implemented caching using transients in WordPress.

Support for multiple widgets

One of the other highlights of this release is that, I have enabled support for multiple instance of the widgets. This will allow users to use multiple widgets, each with its own configuration.

I implemented it using the Widgets API of WordPress.

Translation support

Finally I have also added support for internationalization in my Plugin. The .pot file is under the /languages folder and if you are willing to do translation for the Plugin, use the pot file to create the .po files for your language and let me know.

Download and source code

You can download the Plugin from its homepage and the source code is available at github.

Try out the Plugin and do let me know if you have any feedback or comments.

Posted in WordPress | Tagged , , , | 1 Comment

WordPress Plugin to add Foss.in badge

I just wrote a WordPress Plugin, that allows you to display the Foss.in badge on your WordPress based website.

If you just want a easy setup, then you can just use the sidebar widget that is available when you install the Plugin. If you want more control over the display, then you can the template function yourself. Details about the template function is available in the Plugin’s homepage.

BTW, did I tell you that I am going to be speaking at foss.in? :) Yes, my proposal got selected and I will be talking about building robots using Open hardware like Arduino.

Posted in Events/Conferences, WordPress | Tagged , , | 1 Comment

Posts By Tag Plugin now supports excluding current post

I recently released a couple of updates to my Posts By Tag WordPress Plugin, which allows you to display a list of posts based on tags either in the sidebar as a widget or inside your posts using either shortcodes or a template tag.


The following are the changes that I have made to the Plugin

  • Ability to exclude current post/page
  • Moved caching logic to widget
  • Added Lithuanian translations

Ability to exclude current post/page

One of the most requested feature in the Plugins was to have the ability to exclude the current post in the listing. This could happen when ever you are including the tag of the current post also in the list of tags.

Now I have added an option in the widget to exclude the current post or page.

This option is also available even if you are using either the template tag or the shortcode

Moved caching logic to widget

I have cleaned up the logic which I was using to cache the DB queries used by the Plugin. If you are using the widget, then the output of the widget itself is cached. If for some reason, you don’t want to the widget to cache the queries you can disable it as well.

But if you are using the shortcode or the template tag, then you have to manually cache the output or the db queries.

Dev Time

This release took me about 3.5 hours of development time. You can find more details about the dev time tracking which I have recently started doing in a separate blog post.


You can download the latest version of the Plugin from the Plugin’s home page.


Try out the Plugin and if you have any comments or if you want to report any bugs, please leave a comment below.

Stay updated

I would be posting updates about this Plugin in my blog and in Twitter . If you want to be informed when new version of this Plugin is released, then you can either subscribe to this blog’s RSS feed or follow me in Twitter .


Posted in WordPress | Tagged , , | 1 Comment

Started tracking time spend on my pet projects

Regular readers of my blog will know that I have lot of pet projects. WordPress Plugins, Android Apps, Arduino projects, jQuery Plugins and a whole variety of other hobbies as well.

Some of them are really popular. For instance my Bulk Delete WordPress Plugin has been downloaded for nearly 100,000 times. The flip side of it is that these pet projects have some additional baggage as well. Support questions, regular updates, feature requests etc can be sometimes very time consuming.

I always wanted to know the projects, which takes up most of my free time, but didn’t had any metrics or logs. So I have started to track the amount of time I am spending on each of these projects.

The advantage of this is that, now I know which project are real time hogs and can have some metrics to decide on whether it is worth spending time on those projects or not. I am also going to add this data to the project readme files, so that people who use it might also know the amount of time and effort I have put it on those projects :)

I have already started this and the recent release of my Bulk Delete WordPress Plugin had this metrics. I have spent close to 11 hours for releasing the update to the Plugin.

Let’s see how this new experiment turns out to be.

BTW do you guys also track your time spent on pet projects? If yes, then share your experiences as well.


Posted in Random/Personal, WordPress | Tagged , , | 3 Comments

Bulk Delete Plugin now supports deleting by permalink

I have recently released lot of updates to my Bulk Delete (which is a WordPress Plugin that allows you delete posts in bulk). The new updates allows the user to delete posts based on permalink in addition to deleting by tags or categories.

Like the previous updates, this feature was also requested by the users of the Plugin. So if you have any feedback or feature request, don’t hesitate to contact me, I will try to add them to the Plugin.

New features

The following are the new features that are supported by the Plugin

  • Ability to delete posts by permalink. This features was written by Martin Capodici
  • Major UI revamp. Let me know if you have any feedback about the new UI.
  • Added debug information, which should help you to debug issues related to your server.
  • Added roles and capabilities for menu.

Bug Fixes

The following are some of the bug fixes which have gone into the releases

  • Fixed issues with translations
  • Fixed a major issue in the way how dates were handled
  • Fixed CSS issues in IE


The following are the different languages for which translations have been added. If you are willing to translate the Plugin in your language, then you can find the pot file inside the language’s folder.

  • Turkish
  • Spanish
  • Italian
  • Bulgarian
  • Russian
  • Lithuanian

Dev Time

All these releases combinedly took me about 11 hours of development time. From this release on I have started tracking the amount of time I am spending on each release of my WordPress Plugins. There is a separate blog post, which explains the reasons why I track my development time.


You can download the latest version of the Plugin from the Plugin’s home page.


Try out the Plugin and if you have any comments or if you want to report any bugs, please leave a comment below.

Stay updated

I would be posting updates about this Plugin in my blog and in Twitter . If you want to be informed when new version of this Plugin is released, then you can either subscribe to this blog’s RSS feed or follow me in Twitter .


Posted in WordPress | Tagged , , | 1 Comment

Adopted Cron debug log WordPress Plugin

Recently, I saw a post by Ron (of wpmututorials.com fame) that he is making a couple of his WordPress Plugins available for adoption, since he wanted to concentrate on other stuff in life.

I offered to adopt the Cron Debug Log Plugin because a couple of my own Plugins depend on cron and at times I need to debug if there are any issues with cron and this Plugin could be immensely helpful.

For those who don’t know, Cron Debug Log Plugin can used to debug remote calls made using Cron jobs in WordPress. It basically logs all unsuccessful wp_remote_post calls from Cron.

Ron was kind enough to accept my offer and gave me check-in access to the repo. Over the next few weeks, I am planning to make some modifications to the Plugin and add some features. If you want any specific feature in the Plugin, then do let me know and I will try my best to get it implemented.


In addition to the above Plugin, I have also adopted the following Plugins.

Posted in WordPress | Tagged , , | 3 Comments

Phishing attempts to get your wordpress.org password

Recently, I received an email, claiming to be from WordPress.org, notifying that one of my Plugins have been taken down. It also provided a link where I was supposed to check the status of my Plugin. Clicking on this link took me to a website which looked like wordpress.org and was asking for my username and password.

Even though it looked like a WordPress.org website, the url was different. I posted about it the wp-hackers mailing list and got the confirmation that is a phishing attempt to get your WordPress.org username and password.

If you get an email like below, be careful and don’t click the link or enter your username and password.


In addition follow the following steps to make sure you don’t compromise your account.

  • Check the sending email address. It will always have a wordpress.org email address
  • Check if the link text and the actual link are different.
  • Make sure that the url of the page where you enter your password is always wordpress.org

You can also find more information about it from this forum thread.

WordPress.org has also sent the following email to all the Plugin developers regarding this issue.


Be vigilant and stay safe.

Posted in WordPress | Tagged , , , | 4 Comments