Adding Widgets to Wordpress Plugins

published on April 18, 2009 » filed under WordPress

Looking to add widget support to a wordpress plugin. There’s a lot of misinformation online, its out of date, incomplete or just wrong- I know because I’ve been working on bringing my plugin: up to date.

Peter’s Widgetizing a Wordpress Plugin was an invaluable resource- i can’t say better than that. Read his thorough and exact example for a quick way into wordpress widgets, and check out the rest of Apartment One Six.com I can see it being very helpful in the future.

Mobile Browser Redirect [using .htaccess]

published on April 10, 2009 » filed under Tech, Web

Redirecting the most common mobile browsers (and then some) can be done through a couple of simple Rewrite conditions in your .htaccess file. I think this is beneficial over the multitude of Javascript and CSS hacks out there for a number of reasons, the primary one (as an iPhone user) is speed; who wants to load the whole of a html page, all of its links and css before redirecting to a ‘mobile safe’ page (more load time… more redirects). Most of the how-to’s I found online were concerned with .js hacks… ugh, when you’ve got your own server there really is no excuse. Now:

I need to redirect visitors to my portfolio (which is heavy on images and js, there’s a flash ‘autoviewer’ in there too) to a mobile-safe version, this has lower dimension versions of the same photos in my flash gallery with little of the fuss (read: graphic design). I’m working on the design of that right now. But here’s the crux- the .htaccess required to redirect visitors to a certain folder to a subdomain within that location.

callumalden.com/photography/
magically directs to….
callumalden.com/photography/mobile/

Without loading the /photography/index.php and additional redirect code this is surely the best way to direct mobile users. This bit of code is useful because it also redirects all pages within the ‘photography’ folder to the ‘mobile’ pages. So an attempt at /photography/portraits.php will direct to /mobile/


rewriteengine on
rewritecond %{request_uri} !^/photography/mobile/.*$
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [nc,or]
rewritecond %{http_user_agent} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [nc,or]
rewritecond %{http_user_agent} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up.browser|up.link|audiovox"[nc,or]
rewritecond %{http_user_agent} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[nc,or]
rewritecond %{http_user_agent} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[nc,or]
rewritecond %{http_user_agent} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone/|wap1.|wap2.|iphone|android"[nc]
rewriterule photography/$ /photography/mobile/ [l,r=302]

It may just be my server setup, but I had to use the whole address on the bottom line to achieve the redirect, this is the same on all my .htaccess files. Odd, No? Anyway- pretty handy. If you want to test out the redirect, just change something up there like ’sony’ to ’safari’ or whatever your browser happens to be, save and refresh the browser and you can emulate the iPhone experience. Now, off to code some Blackberry/iPhone-savvy html!

that K2 404 Page

published on February 11, 2009 » filed under Meta Comment, Tech, WordPress

I don’t like the K2 404 page. You’ll only see this when the author (that’s me in this case) makes a fatal mistake or the hosting server has hiccups… but the basic ‘file not found’ page that ships with Wordpress’ most popular theme is awful. The problem is it doesn’t look like a warning page. It offers no additional options, simply points users in the right direction, basically says- “pff, work it out”.

What was not obvious to me was how to override this mess of a information page. How to do it? PHP includes? some form of redirect or did it involve .htaccess

No. To override the default K2 404, which is automatically generated from theloop.php all you need do is place an a file in your wordpress directory called 404.php

Wonderful. What do you think: metacomment.com/blog/404.php

I know there’s a magic plugin out there called ‘recommended posts’, I’d love to tie this in with the 404 page (using the faulty address as a starting point), to give suggestions. Maybe even implement live-search, perhaps a quick email to the blog’s author. Subject: Another 404

Starred Review 1.0

published on February 10, 2009 » filed under Starred Review, Tech, Web, Web 2.0, WordPress

THIS PAGE IS DEPRECIATED -
SEE: metacomment.com/starred-review/
or the Wordpress Plugin Directory

Two years ago I released a patched version of a great little Wordpress plugin called “Starred Review” by Marc Hodges. It didn’t really work that well, it still doesn’t rock the casbah but is now stable on Wordpress 2.7.

Download Starred Review for Wordpress.

You need to upload the starred-review folder and starred-review.php to your ‘plugin’ directory. There’s a readme file in the folder. A changelog too. Fun, eh? Notice (old Starred Review users) that the ‘badge’ code has changed (at least this is true with Wordpress 2.7.1), it is now:
< ?php starred_review_badge('limit', 'category'); ?>

Here’s the homepage: metacomment.com/starred-review/, I promise to upload some CSS magic, an installation tutorial and make good on some old ideas. Thank you!

New RSS Feed

published on June 27, 2008 » filed under Ego, Tech, Web

i have subscribers? apparently so. i’ve moved my feed over to this address:

http://feeds.feedburner.com/metacomment/blog

update your bookmarks if you’d like. also, there may be a new podcast coming some day soon, keep up to date via the Podcast RSS Feed. i know it has been 3 years already.

© Callum Alden
design by callum