Some Good WordPress Hacks

Impact sent us a link to this article about some useful WordPress hacks:
http://www.smashingmagazine.com/2009/04/15/10-exceptional-wordpress-hacks/

The ninth entry, “Highlight Searched Text In Search Results” is a tiny code snippet god-send if you are regular expression illiterate like us:

<?php
$content = nl2br ( strip_tags ( get_the_content ( __( 'more…' ) ) ) );
$keys = explode ( " ", $s );
$content = preg_replace ( "/(" . implode ( "|", $keys ) . ")/iu",

'<strong class="search-excerpt">\0</strong>',
$content);

?>

Works like a champ!

There is also another helpful trick in this article. Up at number four, “Create A Maintenance Page For Your WordPress Blog”. This one is an .htaccess modification to keep visitors from seeing your site while you are making updates…

RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteRule $ /maintenance.html [R=302,L]

Replace the IP Address with yours and you’ll be able to see your pages but everyone else will get redirected to the maintenance.html page. Brilliant!

Cormorants in the Back Yard

Standing on the back patio, waiting for the sun to come out. Hopefully the overcast will burn off in a couple hours and I’ll be able to ride to the beach today. What are those swimming birds that hang out on the pilings with the pelicans? They do not really dive for fish from the air the same way the pelicans do. They swim around and disappear underwater for minutes at a time. They perch on the decaying pilings and spread their wings and push out their chests like they just won something important. Oh no, wait…. they are drying their wings off. Let’s run some Google searches and some Wikipedia look-ups and discover that they are double-crested cormorants…

http://www.youtube.com/watch?v=diRJJL8EISo

The cormorant has been used for centuries for fishing. Trained cormorants hang out with the fisherman and his boat and do their thing, swimming for fish. There is a snare tied around the cormorants’ necks that keep them from swallowing the big fish. It can eat all the little fish it wants but when it gets a big fish stuck in it’s throat, it comes to the fisherman to take the fish out.

comorant_fishing-cn_painting



Links

http://en.wikipedia.org/wiki/Florida_Cormorant
http://en.wikipedia.org/wiki/Cormorant_fishing

Callback Format for FuseKit

clip.slideTo ( x_value, y_value, duration, easing, delay, callback );

Where callback is structure as follows:

clip.slideTo ( […], { scope:this, func:”function_name”, args:argvalue } );

To send multiple args values, send as an array

MixBlendr

A new Java-based application for mixing audio tracks right in your web browser has just launched. MixBlendr is open source and available for download to use on your own website. Right now they have a contest running until April 9, 2009 for best mix of the tracks they posted on their site.

Check it out: mixblendr.com

A new scientific truth does not triumph by convincing its opponents and making them see the light, but rather because its opponents evenutally die, and a new generation grows up that is familiar with it.

Max Planck

WordPress Migration with MySQL

We need to move a WordPress 2.7 install from a development domain to the live environment via straight FTP transfer and phpMyAdmin dump. We bypass the Export / Import functions in WordPress admin so that we can preserve our myriad plugin settings when making the domain switch. But now our links are all pointing at the old URL and the upload path is all wonky. WTF? Fear not, you can fix all those problems by running this tasty little SQL script on your WordPress database via phpMyAdmin (don’t forget to replace the values with the appropriate values for your environment):

## — replace absolute URLs that point to the old domain
UPDATE wp_posts

SET guid = REPLACE ( guid, ‘www.oldsite.com’, ‘www.newsite.com’ )
WHERE guid LIKE ‘%www.oldsite.com%’
;

UPDATE wp_posts

SET post_content = REPLACE ( post_content, ‘www.oldsite.com’, ‘www.newsite.com’ )
WHERE post_content LIKE ‘%www.oldsite.com%’
;

UPDATE wp_options

SET option_value = REPLACE ( option_value, ‘www.oldsite.com’, ‘www.newsite.com’ )
WHERE option_value LIKE ‘%www.oldsite.com%’
;

## — replace absolute server paths
UPDATE wp_options

SET option_value = REPLACE ( option_value, ‘/old/server/path/’, ‘/new/server/path/’ )
WHERE option_value LIKE ‘%/old/server/path/%’
;

UPDATE wp_postmeta

SET meta_value = REPLACE ( meta_value, ‘/old/server/path/’, ‘/new/server/path/’ )
WHERE meta_value LIKE ‘%/old/server/path/%’
;

SMS Stats

SMS text messaging is the most widely used data application on the planet, with 2.4 billion active users, or 74% of all mobile phone subscribers sending and receiving text messages on their phones.

en.wikipedia.org 2009.01