Lots of people have searching about wordpress and prototype.js and have been lading at my post about Alex King’s Share This plugin and prototype.js. At the time I made that post, I wasn’t aware of the wp_enueque_script() function in WordPress 2.1.
Making use of wp_enqueue_script will ensure that your script is only loaded once. It’s really handy, hopefully everyone that uses prototype in their theme or plugin will start using wp_enqueue_script to load the prototype.js file. To load prototype, you’d use wp_enqueue_script like so:
<?php wp_enqueue_script('prototype'); ?>
Prototype isn’t the only script that can be loaded with wp_enqueue_script. Take a look in wp-includes/script-loader.php to see some of the other scripts that wp_enqueue_script can load by default.
After a hard evenings work, I have a much better redirection method to replace the one I described in this post. Previously, I was simply guessing which post a searcher was looking for and displayed a link to that post.
That was all fine and dandy, but I have pretty good search ranking for various keywords. I’d like to keep it that way. After digging around a bit I came across the best method to keep my search rankings in place and manage to redirect the searcher to the desired post. Enter the 301 Permanent Redirect.
I found a nice simple PHP function to do redirection on any number of levels. This function has the ability to send specific HTTP/1.1 status codes based on the type of redirection desired. Since my old permalinks will never be valid again, I chose the 301 Permanent Redirect. A note, the function listed at the URL linked above doesn’t work as-is, you need to modify it. The modified function is below, plus some extra code. All of that code is in my themes header.php file. Continue reading “Improved Permalink Redirection”→
I backup my database, website, and my home directory on a daily basis to a remote server via SSH and rsync. Rsync is a tool that synchronizes directories. I also use it for grabbing current copies of slackware-10.1 and slackware-current.
It’s really easy to backup files to a remote server with these tools. I create tar archives of my needed directories and store the current ones in /opt/backups. I’ve made various bash scripts to do this on a daily basis for me automatically. After that’s complete, the code shown below is run. It transfers my /opt/backups directory to the remote server. It’s path on the remote server would be /home/tyler/backups. All you need to do is set the SERVER variable to the hostname of the server you’re backing up to.
The hardest part is finding a remote server that you’re able to backup to. If you’re lucky, your web host will allow you SSH access. There’s no need for the server end to have rsync installed. All it needs is SSH. I know BlueHost gives account holders SSH access. They’ve been hosting our sites at work for a while now and promptly gave me an SSH account. Their sites said they’d need an ID, but they didn’t require one from me for one reason or another. I backup to a freinds Linux box that’s located in a datacenter somewhere.