Category Archives: WordPress

All about my love for WordPress. BTW, I am self-claimed WordPress Super star.

WordPress and WordPress MU are going to be merged

Yes, you have read the title correctly, the codebase of both WordPress (single user installation) and WordPress MU (multi-user installation) are going to be merged into a single codebase.

Matt, the founder and lead developer of WordPress has announced this news during his State of the Word speech at WordCamp San Francisco.

It is not clear when this merging will be done, but my guess is that they will be merged in WordPress 3.0. Once the integration is done, we can have BuddyPress for single user installs also.

This is great news both for the developers and end users and I am very excited about it. 🙂

Posted in WordPress | Tagged , , | 3 Comments

Quick tip for WordPress Plugin Developers

Hello WordPress Plugin authors, here is a quick trick to link to the latest zip file of your Plugin hosted at the official WordPress Plugin directory.

In order to link to the latest zip file, you have to link to the zip file without the version number. Consider my Bulk Move WordPress Plugin. The latest version of the Plugin (at the time of writing) is 0.2. If you have to link to the latest zip file for download then you have to link to the following url http://downloads.wordpress.org/plugin/bulk-move.zip

Right now this url points to version 0.2 and in future if I update the Plugin to version 0.3 then this url will automatically be mapped to version 0.3.

I use the above format to link to the zip files of my Plugins hosted at WordPress Plugin repository from my blog. The advantage of this method is that, I don’t need to update my links every time I update my Plugin.

Hope you find this tip useful.

Posted in WordPress | Tagged , | 1 Comment

WordPress Plugin Competition 2009

If you are a seasoned (or just a budding) WordPress Plugin author, then here is your chance to show off some of your coding skills. Weblogs Tools Collection is conducting their annual WordPress Plugin Competition.

Dates

The competition began on May 1st and will run till July 31st, a total of three months. You have to develop a new WordPress Plugin and release it in the Plugin Competition blog before the end date.

Prizes

The list of prizes are yet to be released (waiting for sponsors), but there will be a minimum of $1000 for the winner.

Rules

The following are some of the important rules.

  • Should be GPL compatible
  • Compatible with WordPress 2.7 and above.
  • Be secure and use secure coding methods.
  • Should be made available through the WordPress Extend pages
  • Announced and discussed on the Plugin Competition Blog.
  • Preliminary support has to be provided to the public.

So guys, it’s time to sharpen your WordPress skills and all the best for the competition.

PS: I am working on a Plugin (my entry for the competition) and will release it soon. Stay tuned 🙂

Posted in WordPress | Tagged , , | 11 Comments

WpRecipes Contest

WpRecipes.com recently crossed 3000 RSS subscribers and in order to celebrate that they are running a contest. The winners will get free WordPress managed hosting and membership to WordPress theme clubs. You can get more information from the contest page.

All you need to do to participate is to simply write WpRecipes (like this blog post) and post the link in the comments section of the contest page.

For the uninitiated WpRecipes is a blog with cool tips and tweaks about WordPress.

Update: Wow!! It seems that I have won the first prize in the contest. 🙂 I have won one year of free hosting from WPWebHost and one year subscription to Elegant Themes. I am waiting for the prizes to arrive and will try to post a review about them.

Posted in WordPress | Tagged | 4 Comments

Matt, it’s your fault

I was browsing the WordPress official Plugin repository and I came across this error message. It trickled my funny bone and I took a screenshot.

wordpress-error-message
So now I know, if something goes wrong in Plugin repository it is Matt’s fault 🙂

PS: By the way, a page refresh solved the issue and things were working fine after that.

Posted in WordPress | Tagged , , , | 2 Comments

oAuth support in Twitter and WordPress 2.8

After waiting for more than two years, Twitter has finally enabled support for oAuth to all developers using its API. It’s a great move and it’s a win-win situation both for the developers and also for Twitter users. Going forward, the Twitter third-party developers need not ask Twitter users for their username and password.

For the uninitiated, oAuth is an open protocol for online authentication. It enables a user who stores information such as a password on a particular Web site to then authorize yet another site to access that data, all the while not sharing the user’s identity with that site.

To give you a real-world non-technical example, it is like a car valet key, given to a parking assistant. Valet key unlike the original key, will have lot of restrictions like you cannot drive beyond few kilometers or cannot go beyond a particular speed etc.

In a similar move, WordPress 2.8 will also enable support for oAuth. Will Norris, has published an article explaining how oAuth is planned to be implemented in WordPress 2.8. There are yet some limitations (oAuth libraries need PHP5) but it’s a great start.

If you are a WordPress Plugin author of any Plugin that hooks into authentication then you may have to change your Plugin code to support oAuth.

I am really excited about the support for oAuth in Twitter and WordPress. I need to play with them a little once I get some free time. 🙂

Posted in API's/Mashup, WordPress | Tagged , , | 4 Comments

WordPress Plugin Readme File Generator

After writing some WordPress Plugins recently, I found that it takes a lot of effort to generate the Readme file for each of them.

For the uninitiated, readme file is a text file which has meta information about the Plugin and is usually bundled with the Plugin. Readme files for WordPress Plugins are very important, especially if you are planning to upload them to the official repository. WordPress follows a standard for the readme file so that the official repository can parse the meta information present in the file and render it like shown in the below screenshot.

bulk-delete-wordpress-plugin

The official Plugin repository has a sample readme file and also a validator. The readme file should have some tags and the text should be specified in the markdown format.

I was looking for ways to automate the process of generating these readme files and didn’t find a solution. So I created my own 🙂

You can find the WordPress Plugin readme file generator in my projects page and you can use it to generate the readme file for your WordPress Plugins too. 🙂

Try it out guys and let me know if you want any other feature to be added to it.

Posted in WordPress | Tagged , , , | 3 Comments

Retrieving the categories of a blog post in WordPress

While writing my Bulk Move WordPress Plugin, I faced a unique bug. I was breaking my head for nearly two days to find out the correct way to retrieve the categories of a blog post in WordPress. I thought of documenting it here so that I know where I can search for it in future, when I need it and also it might help other WordPress developers who are hunted by the same bug.

Let me try to explain what I was trying to do, why it failed and finally how I rectified it.

Well I was trying to retrieve all the blog posts which satisfy a certain condition and then loop through them and assign them to a new category.

I was using the following code to retrieve the blog posts which satisfied a certain condition. Note that that I am using the built-in WordPress API as much as possible and not directly querying the database. This is one of the good coding practices for writing WordPress Plugins.

$my_query = new WP_Query;
$posts = $my_query->query(array('category__in'=>array($cat_id1, $cat_id2), 'post_type'=>'post', 'nopaging'=>'true'));

Now the variable $posts will have an array of post objects. You can loop through them using foreach.

foreach ($posts as $post) {
    print_r($post);
}

Will print

Array
(
    [ID] => 33
    [post_author] => 1
    [post_date] => 2009-01-19 08:32:41
    [post_date_gmt] => 2009-01-19 08:32:41
    [post_content] => Test from Sudar...
    [post_title] => Sudar Test
    [post_category] => 0
    [post_excerpt] =>
    [post_status] => publish
    [comment_status] => open
    [ping_status] => open
    [post_password] =>
    [post_name] => sudar-test
    [to_ping] =>
    [pinged] =>
    [post_modified] => 2009-02-04 17:54:10
    [post_modified_gmt] => 2009-02-04 17:54:10
    [post_content_filtered] =>
    [post_parent] => 0
    [guid] => http://sudarmuthu.com/?p=33
    [menu_order] => 0
    [post_type] => post
    [post_mime_type] =>
    [comment_count] => 0
)

If you look into the post object, you will see a column called post_category. I was trying to retrieve the category/categories of the blog post by reading this variable. But to my horror, I was getting only zero as value in this variable.

After some hours of hair pulling, I posted about this in the WP-hackers mailing list. It was only then I came to know that post_category is deprecated and we have to use other functions to retrieve the categories to which a blog post belongs to.

So the correct way to retrieve the category/categories is

foreach ($posts as $post) {
    $post_cats = wp_get_post_categories($post->ID);
}

$post_cats will be an array of category ids to which the blog post belongs.

So this is the complete code which you use to retrieve the list of categories to which a blog post belongs.

I didn’t know the fact that the post_category was deprecated and I learned it the hard way 😉

Even though the post_category field is deprecated it is not entirely useless. It can be used while updating a blog post.

Let’s say that you want to move a blog post from one category to another. In this case you can set the array containing the category ids to post_category field and pass it to the wp_update_post () function. Code snippet below

foreach ($posts as $post) {
    $new_cats = array(5,10);
    wp_update_post(array('ID'=>$post->ID,'post_category'=>$new_cats));
}

Whew!! Finally I know how the correct way to retrieve the categories to which a blog post belong to. 😉

Posted in WordPress | Tagged , | 25 Comments

WordPress 2.7.1 Released

WordPress 2.7.1 has been released and I just updated this blog.

It is a maintanence release for WordPress 2.7 and the official WordPress development blog reports that this release has fixes for around 68 tickets. Some of these tickets are bug fixes and therefore it is a recommended upgraded.

Since no new features have been introduced, this release should not break any of your Plugins or themes.

Posted in WordPress | Tagged | Leave a comment

BuddyPress for Single user WordPress installs – Confirmed

Well, the rumours are confirmed now. BuddyPress is going to be available for single user WordPress installs, later this year. The news has been confirmed by Andy Peatling, the lead developer behind BuddyPress, whom Automattic (the parent company behind WordPress) recruited to build BuddyPress.

So here is the tweet by Andy Peatling confirming the news

andy-peatling
This tweet was in reply to the following tweet
buddypress

It’s really very good news that BuddyPress is going to be available for single user WordPress installs, because when compared with WordPress MU, single-use WP is easy to install and maintain. Also this will surely increase the adoption rate of BuddyPress.

Also BuddyPress is getting stable and the 1.0 version might be released on Feb 12th 2009.

Meanwhile, if you are wondering what the heck is BuddyPress, then let me explain. It is a set of WordPress MU Plugins which will convert a plain WordPress MU install into a social network platform. You can get more information about BuddyPress at it’s about page.

Posted in WordPress | Tagged , , | 6 Comments