Random WordPress Tidbits, New Artwork, and Happy New Year

What better way to end this year and decade but with a hodgepodge post consisting of three completely unrelated topics?

WordPress Tidbits

It’s been a week since I converted this website to WordPress. I have continued to play around with the website, changing some minor details here and there. The most significant change in terms of the design since a week ago is the addition of random backgrounds. I only have three backgrounds thus far, but more will be added to list as I accumulate more photos and artwork. Once I have enough backgrounds, I’ll modify the script so that different months of the year will have a different set of backgrounds so that this blog will always match up with the seasons. Other than the backgrounds, the top menus have been made semi-transparent, but that’s just a tiny change.

Moving on to features of the sites, I have installed a quicktags and smilies bar plug-in to the comment form, so visitors will have an easier formatting comments to their hearts’ content. Hopefully that will encourage some comments, as this site hasn’t received a non-spam comment for a while. I did have to try out a few quicktag/smilies plug-in before I found one that worked out of the box, but once I found the one it was smooth sailing from there.

For the most part, WordPress and all of plug-ins I’ve installed are well-behaved with the notable exception of WP-Postviews, which is used to keep track of how many times a post has been viewed. For some odd reason, WP-Postviews would only count hits from logged-in users (ex me) and not guests even when I set the plug-in to track everyone. The plug-in wouldn’t count anything when I set it to count only guests. After experimenting with the code, I discovered that the $post global variable within the counting function did not return the correct post ID number when a guest loaded a post. The original first few lines of process_postviews() is shown below:

### Function: Calculate Post Views
add_action('wp_head', 'process_postviews');
function process_postviews() {
global $user_ID, $post;
if(!wp_is_post_revision($post)) {
if(is_single() || is_page()) {
$id = intval($post->ID);
$views_options = get_option('views_options');
$post_views = get_post_custom($id);
$post_views = intval($post_views['views'][0]);

In order to get the plug-in to count guest hits, I had to switch to use $wp_query and extract the post ID from there. The modified function is shown below:

### Function: Calculate Post Views
add_action('wp_head', 'process_postviews');
function process_postviews() {
global $user_ID, $wp_query;
if(!wp_is_post_revision($wp_query->post)) {
if(is_single() || is_page()) {
$id = intval($wp_query->post->ID);
$views_options = get_option('views_options');
$post_views = get_post_custom($id);
$post_views = intval($post_views['views'][0]);

I don’t know the reason why the original function didn’t work on my website. I’m guessing it has something to do with the templates of the theme, but now that I have the plug-in working I’m too lazy to investigate.

Artwork

Below is my newest Photoshop artwork. I liked how the grassy knoll and dandelions turned out, but the two kids look like cardboard cutouts. Time to work on my people-drawing skills.

Happy New Year!

Another year has gone by, and along with it another decade as well. 2009 went really quickly for me. I spent eight months working as an intern and four months in school, and time just flashed by. 2010 will be a really important year for me. It will be the year when I finally earn my bachelors degree and (hopefully) it’ll also be the year when I start graduate school. It’ll be a busy year that’s for sure, but I think I’m ready for it. I wish all of you (the 5 random people who read this blog) a Happy 2010 and good luck in the new year. I’ll definitely need some of that luck too :D

Related Posts

TJ Online Relaunched I'm on winter vacation right now, and I don't plan on going anywhere. Therefore, there's no better things for me to do but to pay some attention to my...
Badminton Portal and Travel Log Rebuilt Over the last couple of weeks, I have been working on some of my other websites and the work is finally (nearly) complete. Firstly, the main area of T...
TonyJiang.com: Fourth Year on the Net I can't believe it's been four years already since I set up the tonyjiang.com domain. Actually, the anniversary is somewhere in August, but I was busy...

Leave a Reply

Your email address will not be published. Required fields are marked *