WordPress WP-PostViews plugin to display special characters properly

wordpress-3A useful WordPress plugin is WP-PostViews. This plugin enables the display of number of times a post or page had been viewed. However, it there is an odd behavior when handling special characters. According to one definition, HTML special characters and symbols that cannot be generated in HTML with normal keyboard commands may be produced using HTML entities and/or ISO Latin-1 codes that can be placed in source code like any other alphanumeric characters. WP-PostViews does not produce the desired special character, however, instead displays the ISO Latin-1 code. There is a quick fix to this.

I found the line of code in wp-postviews-widget.php that handles special characters and commented it out to produce the desired results. The original code is displayed below.

postviews-3

With the original code, the result is easily seen in the Most Viewed OKEH 1007 – The World …

postviews-1

The code that should be commented out is displayed below.

postviews-2

Update: I just noticed that the code indicated above that there are a couple of coding issues. Though it still works, it should be.

echo ':

'.

The result

postviews-4

Note: For those that may have noticed that the before and after pictures of the Most Viewed are taken at different times, hence the reason for the discrepancy in the number of views.

Update: The above “hack” does work for versions prior to 1.4. I had just noted on two separate installations of WordPress 2.7 with version 1.4, that the “hack” is not in place and wp-postviews do display the special characters. So, this post may only effect a minor few.