Tag Archives: WordPress

No Browse Happy Plugin

There was a thread in the WordPress hackers mailing (wp-hackers) list today discussing about the browse happy logo which is displayed in the footer of WordPress admin screens, when a user views the admin pages using Internet Explorer.

There were lot of arguments for and against the removal of this logo, at least for IE7. I found that there was even a ticket created in trac (WordPress public bug reporting database) for removing it, which was closed by Matt as wontfix. I personally felt it was a very minor thing to argue about and I neither agree nor disagree in removing it.

Someone in the thread suggested that we can create a Plugin which could output some CSS to hide the logo, which let me to create a very small (probably useless) Plugin called No Browse Happy Plugin. This is similar to the No Howdy Plugin by Ozh, very useless in my point of view but might matter a lot for someone.

If you look at the source code you could find that it is nothing fancy but just an echo statement which prints the following CSS code in the header.

#bh {
display: none;
}

In short, I just wasted two minutes to stop someone from wasting hours in arguing about something which is useless (at least in my point of view). ๐Ÿ™‚

Posted in Plugin Releases | Tagged , , , | 7 Comments

Reverse the order of comments without editing theme

I was looking for a way to reverse the order in which comments are displayed in a WordPress blog for one of my projects. After a bit of Googling I found a Plugin called Reverse Order Comments. A quick look into the source code revealed that it was rewriting the comment template and you need to edit the theme to make it work. My instinct told me that it would be easy to accomplish it using the array_reverse comment in PHP.

I followed my instinct and tried to see whether it is possible to do it in a simple way. In the end I accomplished it with less than 10 lines of code and more importantly without the need to edit the theme files. Another instance of the KISS principle in action ๐Ÿ˜‰

I packed it as a Plugin so that you can just drop it into your plugins directory, activate it and then forget about it. It is called Simple Reverse Comments and you can download it from my Plugins page.

Posted in Plugin Releases | Tagged , , | 7 Comments

Year End Stats for 2007 (Graphs)

When I published my year end stats, little did I know that numbers alone doesn’t matter much, unless they are presented in an easily-to understand manner.

So here I am representing the same numbers but in a much more understandable manner, with some support from the excellent Google Chart API, which I learned during pipesCamp.

Number of posts

You could see that the number of posts has almost dropped by 40% in 2007. There were 64 posts in 2006 where as only 38 in 2007. One reason for this is that lot of unexpected things happened in my personal life which took me away from the computer and the other reason is that I got busy and free time became a rare commodity for me. So this is an area where I should improve.

Number of comments

Again, as with the number of posts, the number of comments was also less by around 40%. There were 394 comments in 2006 but only 220 in 2007. This also includes my own comments; maybe I should represent my comments separately.

Average number of characters in posts

This graph clearly shows that average number of characters in my posts. Even though I have written fewer posts in 2007, the average number of characters has increased, which is good (which also means that I have become very talkative ๐Ÿ˜‰ ). This is very good and is also motivating. In 2008 I should keep up the length of the posts and at the same time should also try to increase their number.

Total number of characters in posts

This graph clearly shows that even though I have written fewer posts, I have almost written the same amount of characters in 2007 when compared with 2006, which is again motivating.

I have really become addicted to stats now and will try to dig more deep into my blog to unearth other valuable information when I get some time. This explains why everybody was soo fascinated by Yuvi’s cool graphs.

Meanwhile you can also publish your yearend stats by using my Year End Stats WordPress Plugin. So what does your yearend stats speak about your blogging habit? Please leave a link to your yearend stats in the comments so that I can have a look at it.

PS: I would really love to see how Yuvi has scaled up this year. May be Yuvi, do it when you find time in between your exams.

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

Year End Stats for 2007

Publishing year end stats seems to be the new fashion and so here are the year end stats for my blog.

  • Total number of posts in 2007: 38 Posts
  • Total number of comments in 2007: 220 comments
  • Average length of posts in 2007: 3048.03 Letters
  • Total length of all posts in 2007: 115825 Letters

By the way this is very low when compared to my previous year (2006) stats

  • Total number of posts in 2006: 64 Posts
  • Total number of comments in 2006: 394 Comments
  • Average length of posts in 2006: 1813.16 Letters
  • Total length of all posts in 2006: 116042 Letters

I guess it is right time that I start writing more on my blog. So here goes my first resolution for the year 2008, write more in my blog. ๐Ÿ™‚

I have also created a WordPress Plugin called WP Year End stats which you can use to get stats for your blog.

Wish you all a happy new year ๐Ÿ™‚

Posted in WordPress | Tagged , , , | 5 Comments

WordPress and MySQL character encoding

Recently I moved my WordPress blog to a new server. I took the dump of the old database and imported it into the new MySQL server. Everything was fine except that I stated getting some strange characters in my posts. For instance I was getting (Nov รขโ‚ฌ” 3rd รขโ‚ฌ” 2007) instead of (Nov – 3rd – 2007).

It took me lot of research and googling to find the solution and so I thought of sharing it here so that it would be helpful for others who might face the same problem.

First I raised a support request in WordPress, but didn’t get a reply. After some googling, I found that it was due to wrong character set in my new MySQL server. Instead of having utf8 as the character set the MySQL database server was running in the default latin1 character set.

I changed the character set in the MySQL my.conf file and also in the wp-config.php file of WordPress and re imported the tables. Even this didn’t solve my problem. Later I found that there were certain characters in my wp-posts table which were encoded in latin1 character set even though the table is set to utf8 character set.

I then exported the table using a tool called Heidisql (which is by the way an excellent alternative to the command line MySQL client). I then opened the sql file in a text editor and changed all instances of latin1 to utf8 (basically a find/replace). I saved the file and imported the tables again and the junk characters are gone. ๐Ÿ™‚

So the lesson learned the harder way, KEEP EVERYTHING IN UTF-8, ABSOLUTELY EVERYWHERE, FROM DAY ONE. Youโ€™ll be glad you did some day.

Posted in Database Programming, WordPress | Tagged , , , , | 1 Comment

CSS Naked day 07

If you are wondering why my site is lacking its original design then it’s because I am participating in the CSS Naked day 07 like last year.

Well, if you are going to ask me what is CSS Naked day then here is the extract from the official site.

The idea behind this event is to promote Web Standards. Plain and simple. This includes proper use of (x)html, semantic markup, a good hierarchy structure, and of course, a good ‘ol play on words.

If even you want to participate then register your site in the official site and then strip the CSS from your site. If you are on WordPress then you can use this plugin.

Happy stripping ๐Ÿ˜‰

Posted in Web Programming | Tagged , , | 1 Comment

WordPress 2.1 – More editing options in WYSIWYG editor

Update: This blog post is outdated. Use TinyMCE Advanced WordPress Plugin instead.

Chris Kasten has found an Easter egg in WordPress 2.1 which enables many advanced buttons and options in your WYSIWYG editor. To get these advanced buttons you need to press alt-shift-v in Firefox or alt-v in IE. Pressing the same keys again hides it. Nice find right? But it will only work if you have enabled visual editor in your user profile.

After reading about it I was trying to find out whether it is possible to enable it by default. After some googling I found this thread in WordPress Support forum. To enable these advanced buttons by default, you need to fiddle with some files in the wp-includes folder. The tiny_mce_config.php file in the wp-includes\js\tinymce directory to be exact. You need to open the file directly and remove the ‘wp_adv_start‘ and ‘wp_adv_end‘ present on line 31. (Do this only if you are brave at heart ๐Ÿ˜‰ ).

When I was testing the change I noticed that WordPress 2.1 also missed the ‘Edit HTML source’ button which was available in the previous versions. This made me to search the TinyMCE documentation and there I found that TinyMCE has lot of other formatting options too. And after some fiddling I have picked up all those buttons which I may use.WordPress WYSIWYG Editor buttons

This is how my editor looks now. If you want all these options start editing your tiny_mce_config.php file or just grab my file and put it in the wp-includes\js\tinymce directory. (Be warned I am not responsible if something breaks ๐Ÿ˜‰ and don’t forget to backup your original file). Also remember that next time you update your WordPress installation this file could be over written.

The new buttons which I like are

  • Paste as simple Text
  • Plase from Word
  • Format cleaner
  • Insert Customer Character
  • Subscript, superscript

There are still some more buttons and options available and if you want to use them, then have a look at TinyMCE manual and change your config file accordingly. Meanwhile I will try to find out whether it is possible to have a WordPress plugin do it so that you don’t need to edit your file manually and till then happy hacking ๐Ÿ˜‰

Posted in WordPress | Tagged , , , | 11 Comments

WordPress 2.1 and custom field plugin Gotcha

I found a strange behavior in my blog after my recent upgrade to WordPress 2.1. Every time some one posts a comment the technorati tags for that particular posts were disappearing. After some debugging I found that it was caused by a plugin which I was using and not by WordPress itself.

And a little bit of searching let me to a thread in WordPress support forum, where some other people also were facing the same problem. With a little more digging I found an excellent explanation by Mark, where he describes the exact problem and also the solution. I am not going to explain the problem here because, Mark has already explained it in a very simple and precise manner and I don’t think I can do anything better.

The plugin which I was using to store my technorati tags was Bunny’s Technorati tags (to which I migrated some time back from Simple tags). I incorporated Mark’s fix and re-deployed the plugin and everything is working fine now.

I am going to update the plugin’s page at wp-plugin.org and meanwhile you can also bunny-tags.zip. Please note that this plugin was developed by Stephanie Booth and the full credit goes to her and I have just updated it to work with WordPress 2.1.

Let me know if you still face any issue with it. Happy upgrading ๐Ÿ˜‰

Posted in WordPress | Tagged , , , | 21 Comments

Going to update WordPress, expect some turbulence

Guys, I am going to update my WordPress installation to WordPress 2.1 codenamed Ella. (Yes, yes I know I am late by 5 days this time).

Unlike my older updates, I am going to completely delete the files in the core directory and then going to place the latest files. So you may notice a small turbulence and I will try to keep the downtime (if any) to the minimum.

I am planning to finish the whole process with in 30 minutes and will post an update once the process is over.

Update: Everything went smoothly and this blog is now proudly running on WordPress 2.1

Update (29 Jan 2007): Well guys, the update was not as smooth as I expected. There is a small issue with the Bunny’s Technorati Tags plug in which I am using. Will post an update once I fix it.

Posted in WordPress | Tagged , | 4 Comments

Migrated from Simple Tags to Bunny Technorati Tags

Both Simple Tags and Bunny Technorati Tags are nothing but WordPress Plugins, in case if you are wondering what the hell I am taking about. ๐Ÿ˜‰

Both the above plug-ins lets you to insert Technorati tags in your blog posts. I have been using Simple Tags for quite some time but was not happy with its working. It stores the technorati tags with the blog post itself inside [tags][/tags] tags and they can be displayed only at the end of the posts. I found this very limiting because it was not suiting my recent design change. I wanted to display these technorati tags on a separate box on top of every post, but with Simple Tags this will not be possible.

So I searched for other plug-ins and found that Bunny Technorati Tags suits my needs. But then I have to remove the [tags][/tags] from every posts and include them inside a custom field.

Instead of doing it manually I wrote a PHP script to make the necessary changes to the table. If any one of you is also planning to do the same migration then you can grab the script and save some hours of copy pasting.

Now, after the migration I am able to place the technorati tags in the correct place where I wanted it to be displayed.

Posted in WordPress | Tagged , , | 2 Comments