Coyote Mercury

words, birds and whatever else by James Brush

Tag: wordpress (page 1 of 2)

Photo Gallery Experiment

This is just me playing with the WordPress Galleries and Carousel features. Old pictures already in the media library. Click on one for the carousel effect.

How to Move WordPress & Change the URL

When I decided to move Coyote Mercury to a new host, I figured I’d take the opportunity to make a slight change in the URL. When I started blogging almost five years ago, I already had Coyote Mercury running as a static site and installed WordPress in a sub-directory, which made the URL Eventually, the blog became the whole of the site and when I decided to change hosts, I wanted to get rid of that /blog1. It wasn’t a big deal and I could have lived with it, but what I really enjoy is the puzzle of solving problems I create for myself and this looked like a perfect opportunity to do just that.

The main issues would be making sure that all those links from all those other bloggers who’ve been kind enough to link to my site would redirect to the correct pages as well as all of my internal links. I also needed to make sure that the /blog1 rss feed would redirect. What follows is mainly a summary of what I learned and where on the web I found what I needed for anyone attempting a similar move.

Moving My Blog to a New Host & Changing the URL

1. Before doing anything, I used the WordPress export tool to download my WP database to my computer as an XML file. I then FTP’d all my files from my old host to my hard drive, making sure to maintain the exact file structure as it appeared at my old site.

I decided I wanted a clean install of WordPress along with a clean database to start with. There were some things that didn’t work at my old site like pingbacks and my old host didn’t allow the use of .htaccess so I wanted to make sure that everything was installed in such a way as to work well at Bluehost.

2. Bluehost has a one-click WordPress installer and so I used that to start with, installing WordPress in the root directory. Once that was done, I went into cPanel, found the file manager, deleted the new wp-content folder, and uploaded my old wp-content folder (which contains all the plugins, themes and uploads) into the root directory.

3. At this point I had a temporary URL and so I logged into my new WordPress install, went to tools and imported that XML file from step 1. Foolishly, I did not check the box that asks if you want to import and upload attachments. This would come back to haunt me, but I would eventually figure out how to fix it.

4. Once all my posts were imported, I opened up my blog’s dashboard both at my old host and on my new host (where it was running on a temporary URL) and went through each screen to make sure that all my plugins and options were configured the same way. The only difference was on the General Settings page where the WordPress address and the site address on the Bluehost installation were the temporary URL.

This is also wheb I discovered that the media library was empty even though the files were all in the right place. It was a result of the mistake I made in step 3. Keep reading to learn how I fixed it.

5. The next step required me to venture into phpmyadmin and make some changes to my database so that WordPress would function on my URL rather than the temporary URL supplied by BlueHost.

(Disclaimer: If you’re using this post as a guide to moving your own WordPress, please be very very careful with phpmyadmin. Your database is your blog’s memory and it is very easy to perform a lobotomy if you’re not careful. Check your spelling. There is no undo in phpmyadmin. I am not responsible for your site’s database if you try any of this and it doesn’t work for you.)

Using phpmyadmin, I ran the following SQL command, which is based on what I found at My Digital Life:

UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';

If I had decided to maintain the URL, I would basically be finished. All I would need to do now would be to point the domain name servers from my old host to my new host, but because I was changing the URL, I would need to run a couple more SQL commands in phpmyadmin, both of which came from My Digital Life, where you can find more detailed explanations about the whys and wherefores of all this.

The next SQL command would change the URLs of all my old posts and pages so as to get rid of the /blog1:

UPDATE wp_posts SET guid = replace(guid, '','');

The final SQL command rewrote all of my internal links so that they would still point to the correct posts:

UPDATE wp_posts SET post_content = replace(post_content, '', '');

6. Once I was finished running these commands, I logged into my old host’s control panel and pointed the name servers toward Bluehost and waited. For a few minutes nothing worked, then everything was jacked up and then… my site looked right. The images were there. The internal links were correctly rewritten, things looked right. Now, it was time to redirect inbound links.

Redirecting Inbound Links

7. The next thing to do was to make sure that all inbound links still went to the right place. I put a /blog1 subdirectory in the root folder and then used the text editor to write a simple note indicating that the site had moved. I saved it as index.php and put in in the /blog1 folder in case my redirects didn’t work.

8. Permanent (301) Redirects are properly done using .htaccess, which is completely new to me. I read a lot about it at Codeleet, Cats Who Code, and Expression Web, where I learned that Bluehost has a nice redirect feature in cPanel that writes and inserts the .htaccess code for you. I did that and it worked well. I went to a few sites that had links pointing to some of my posts and pages, including the home page, tested them out and it all seemed to work.

Redirecting the RSS Feed

9. Redirecting the RSS feed from /blog1/feed/ was a bit more challenging. I used the redirect feature in cPanel, but it didn’t redirect the feed. This could be a problem since many of my regular readers seem to come via the feed. Without a redirected feed, they might not realize I had moved. I did some research at Cats Who Code, Nanny Goats in Panties, RSS Advisory Board, Advertising Age, Radio Userland, and  The RSS Blog where I found the code for an XML level redirect.

I added a sub-directory into my mostly empty /blog1 folder and called it /feed. Then I opened my text editor and pasted the following code from The RSS Blog (with changed to reflect the address of my new feed):

<?xml version="1.0" ?>

I saved this file as index.php and uploaded it to /blog1/feed/ and my feed started redirecting.

I’m not sure why, but it seems there needs to be both redirection code in the .htaccess file and an active file from which to redirect.

Making the Media Library Work

10. Like I said back in Step 3, I forgot to tell WordPress to import the attachments from the XML file I had exported in Step 1. The result was that while images displayed in posts, the media library appeared to be empty and when I clicked on images, I got 404 errors instead of attachment pages. After doing some research, I learned that the attachment pages were kept along with posts and pages in the wp_posts table of the database.

To fix things, I went back to phpmyadmin at my old host and exported the wp_posts table to my hard drive as an SQL file. Then, I went to phpmyadmin at Bluehost, dropped (which means deleted) the wp_posts table and then imported the wp_posts SQL file to my new host. Since I had now undone some of what I had done earlier, I had to re-run those last 2 SQL commands in Step 5.

Now, the media library was populated and the attachment pages worked, except where thumbnail images were involved. Wherever thumbnails appeared such as on galleries, they were displaying at full size. I checked to see that the thumbnails were in fact on the server (they were) and then began researching which part of the database contained the info that connected the thumbnails to the attachment pages. Turns out that was in the wp_postmeta table.

11. I went back to phpmyadmin at my old host and exported wp_postmeta as an SQL file to my computer. Then, I went to phpmyadmin at my new host, dropped wp_postmeta and imported the wp_postmeta SQL file from my computer.

Now, I had to run one more SQL command, this one of my own creation, but based on the ones I ran in Step 5:

UPDATE wp_postmeta SET meta_value = replace(meta_value, '/blog1/wp-content', '/wp-content');

And, it worked. For me. Be careful if you try this yourself since your blog may have a different file structure. If it does and you try this, you could damage your database. Of course if that happens you can always go back to Step 1, start over and remember to check that box about importing the media library.

And now I’m done and looking forward to getting back to blogging.

Coyote Mercury Has Moved (But Not Far)

I’ve changed to a new host and in the process decided to change my URL by dropping the /blog1, which I’ve never cared for. Hopefully, I’ve done this in such a way that inbound links will redirect as should the rss feed. We’ll see. Things might be a bit wonky over here while I get settled in.

Here’s the new URL for those inclined to update your blogrolls:

and for those using feed readers, here’s the new rss url:

It will take 24-72 hours for the changes to propagate across the internet so hopefully things will be working by the weekend.

Let me know if you notice anything jacked up around here. I appreciate it. Thanks.

Four and Twenty and Housekeeping

Two things:

1. While I was out of town last week, I forgot to link to Four and Twenty, where one of my haiku was featured as the “Four and Twenty of the week.” Check it out.

2. You may have noticed the type on my site is larger. Ever since I redesigned the site in Jan 2009 to ditch the 2nd sidebar and widen the content area to accommodate larger photos something has bugged me about the font. I’ve tried different fonts but after reading iA’s The 100% Easy-2-Read Standard (h/t Dave for the link), I realized that what was bugging me was the size of the font relative to the expanded line length.

I tried a larger font, and I like the results. How does it look out there in blog land? Easier on the eyes?

Gone Mobile

I just installed the WPTouch plugin, which generates a slightly different more mobile-friendly version of Coyote Mercury should you visit the site on a mobile device. It looks good on my iphone. Check it out and let me know if it looks jacked up on any other devices.

I’ve been playing with other plugins and doing some general code-tweaking lately as well. Notice the nice little seagull favicon up by the URL?

More Trees & Winter Trail

Twisted Branch

I noticed this tree the other day while I was walking along the neighborhood trail looking for birds. As to birds, I mostly saw the usual suspects, though I did see Cedar Waxwings, which was the first time I’ve seen them in the neighborhood. The Ring-necked Ducks finally returned as well, but this time, I tried to see the trees and spend some time with them.

It was cold here last week, the coldest it’s been since 1976 according to the paper, and so I set out to see if things looked different in that brittle winter light we see so rarely here.

It’s been dry so no snow or freezing precipitation, but I did see some ice along the muddy edge of the stream. I doubt I would have seen it if I hadn’t first heard my boots crunching through it. Nothing too impressive as far as ice cover goes, but ice outside of a drinking glass is a novelty around here.

This is the view looking up the stream (southwest). I still can’t get over the damage last summer’s hailstorm did. Most of the trees that lost their fight with the sky that night have been cleared away, but I like that this one was left over the creek like a little bridge for night-scurrying animals.

I wonder if a small tornado came through this part of the trail since so many trees were felled. If you draw a line from this spot to our house and a few blocks beyond, most of the roofs along that line had to be replaced (including ours). I guess the trees didn’t stand much of a chance.

I’ll write about the birds and my big medium small year that concluded with this icy walk in the next few days.

Just for grins, I recoded my site so that the sidebar loads after the posts, a thing which needed doing for quite some time. It’s nothing a reader would likely notice except that the site might load faster now, but what prompted me to do it is this nice enhanced gallery feature in WordPress 2.9. Here’s a gallery of pictures from my walk. Clicking on them will display them at a higher resolution on their own image pages.

In non, tree, bird or WordPress news, I was happy to see that my prose/poetry piece “The Man Who Spoke the Law” (originally published at qarrtsiluni back in October) was included on Adam Ford’s January 2010 Poetry Mixtape. Check it out. He says nice things about “The Man Who Spoke the Law” and there are links to some really terrific poems on the same mixtape.

Coyote Mercury’s New Look for 2009

For several months I’ve been wanting to change the look of the blog. I searched high and low for a theme that would have a simple, uncluttered look. I wanted compatability with WordPress 2.7’s new features as well as image pages and a larger content area to display larger images.

Then, inspired by Robert Pirsig’s Zen and the Art of Motorcycle Maintenance (see my post about Zen and the Art and its impact on this blog), I decided that it would be of higher Quality to learn CSS and do the theme myself.

I used some pieces of my old Gila theme (which I had heavily modified over the years), but rather than thinking thoughts like “what can I make Gila do?” I tried to focus on making the site look how I want it and then learning how to do it myself.

More than anything, I wanted something that had a clean and simple design, if not exactly minimalist. The home page, my book page, stories & poems page, and the about me page reflect that. The blog page differs because there’s just more that I like on the sidebar there.

Click the photo below for a look at the image page. Most of the photos I’ve posted since mid-November will link to their own pages now.

Some trees near the pond

Some trees near the pond

Additionally, I wanted to minimize sidebar clutter and focus on sidebar info that’s actually used by people who visit this site. Archives and most of the links on the blogroll now have their own page (friends/family/favorite links are staying in the sidebar). I also rewrote the about me page to make it more personal.

I’m pleased with the end result, but I’ll probably tinker with it a bit more as things come to mind.

Please let me know if anything looks wonky in your browser or if there’s something obvious that seems to be missing.

Gravatars in WordPress, or What the %$#@ is a Gravatar?!?

The other day Mike from 10000 Birds left a comment here. What startled me was the fact that there was a picture of him next to his comment in my admin interface. How the devil did he do that? I thought.

I checked the image properties and found that it was served by, a site that allows you to upload a picture and associate it with an email address. Then whenever you use that address to log into a forum or blog that supports gravatars, your picture comes up by your name.

The latest WordPress versions support this, and so I studied the default theme and adjusted my comments.php file to show gravatars. A little CSS styling to tweak and there it was.

If you comment here, consider visiting and signing up for a gravatar, then leave a comment and your gravatar will appear alongside your comment.

If you don’t have one, WordPress will just generate a little pattern. I can also set it to display cartoon monsters for each commenter. Should I do that? Hopefully nobody would be offended.

Want to add gravatars to your WordPress theme? Here’s how:

Simply open your theme’s comments.php file and add the following code (the 40 gives the size of the image in pixels):

< ?php echo get_avatar( $comment, 40 ); ?>

Before this line (assuming your comments.php is based on the default theme):

< ?php comment_author_link() ?> says:

You’ll probably need to make a few adjustments to your CSS as well. I just lifted these lines from the default theme’s style.css and adjusted them to suit my theme:

.commentlist li .avatar {
	float: right;
	border: 1px solid #eee;
	padding: 2px;
	background: #fff;

Easy as can be.

For more, visit the WordPress codex.

Hacked Off

Last week, while trying to fix a plugin that had stopped working after the last WordPress upgrade, I noticed an odd bit of code. Upon further investigation with the use of Google’s text-only feature on their cached page search, I found that my blog had been hacked and turned into a spam blog.

Didn’t notice did you? Neither did I. I think it happened back in April. Basically, the hackers get in and hide hundreds of links in your header or footer that are then rendered invisible by some kind of CSS trick, all accomplished through the use of an invisible plugin.

Then your blog looks and works like it always did, but the Googlebots see hundreds of links to sites selling porn, gambling, and various pharmaceutical delights.

This appears to have happened back in April at exactly the time I quit blogging regularly so I never noticed. It seems hundreds of WordPress blogs were affected and so there is plenty of info out there about fixing this hack, both on the WordPress support forums and elsewhere.

Here’s what I discovered:

  • a hidden user account on my blog that couldn’t be deleted through the admin interface
  • a plugin that didn’t show up on my plugin screen
  • several files in my directory and various subdirectories that were not placed there by me or WordPress

After reading up on this, I deleted everything from my directories that was not put there by me. I also deleted all the old subdirectories left over from my site’s first pre-blogging incarnation (while rediscovering the cool sky you now see in the background) and a very old test blog I created and never upgraded.

Then, I had to go into the mysql database, which forced me to learn a lot more about both mysql and phpmyadmin than I had ever known previously. Messing with the database is risky. As the warning says on the WordPress site, “with great power comes great responsibility.”

I figured it out, though. I was able to go into the database and delete the phantom user, turn off the phantom plugin and delete a mysterious table that shouldn’t have been there.

Had it not been for the following sites, I would not have had the foggiest idea how to do these things so big shout-outs to:, WordPress Philippines,, Ms. Adventures in Italy, and especially to Get Rich Slowly for their detailed instructions on dealing with the database cleanup. (How odd that 2 of these sites are from The Philippines and Italy, both countries in which I’ve lived).

The WordPress support forums were also helpful as always.

Once the database was cleaned up and the directories cleaned, I reinstalled the latest WordPress and changed every password associated with my web host and this blog. Probably a good thing to do from time to time anyway.

Now that the site is cleaned out and the hidden links are gone, I have to get back into Mr. Google’s good graces. The Googlebots have apparently determined that my site is a spam links blog and so my site no longer shows up in Google searches. I had noticed that my traffic dropped tremendously back in April, but I had assumed it was because I had slowed down on posting. Fortunately, Google has a tool in Google Webmasters to have a site reevaluated, so hopefully, my traffic will come back.

This wasn’t an awful experience. I was lucky and I managed to learn alot.

I am no longer afraid of phpMyAdmin and the mysql database (even if I don’t totally get them yet).

I was reminded of the importance of regular upgrades.

I was reminded of the importance of keeping my directories neat and clean.

I learned to periodically check over the code in my theme files and look at cached pages for anything that might be awry.

I learned about Google Webmaster Tools and the Firefox Web Developer Toolbar, both very useful for anyone running a website.

I wrote a few months ago that one of the things I like about running a self-hosted WordPress is that I’m running more than just a blog, I’m running a website. That still holds true even if I have to spend a week dealing with the mess created by some worthless waste of skin who decided to use my blog as a tool in their nefarious link scheme.

For those who may be wondering about the missing comments issue this week, that was a totally unrelated thing. Two days after cleaning up the hack mess, my host had a problem with their mysql server that temporarily ate the comments and caused a few other problems, which they have happily fixed. Thanks to Kevin Dewalt and whooami for their help in figuring out that issue.

And, now, everything seems right with the cyberworld and hopefully, Mr. Google will come back too.

Zen and the Art of Blog Maintenance

I’ve been reading Robert Pirsig’s Zen and the Art of Motorcycle Maintenance. His quest to understand Quality and his thoughts about the joy he finds in keeping his machine running have gotten me thinking about all kinds of things I do: writing, teaching, teaching writing, photography, blogging, and blog maintenance.

Mostly blog maintenance. First, I want to think about keeping it running as a piece of software on a machine as opposed to writing the content that appears on the screen.

Pirsig writes eloquently about the process of maintaining a motorcycle:

The thing to do when working on a motorcycle, as in any other task, is to cultivate the peace of mind that does not separate one’s self from one’s surroundings.


Peace of mind produces right values, right values produce right thoughts. Right thoughts produce right actions and right actions produce work which will be a material reflection for others to see of the serenity at the center of it all.

The difficulty lies in the various traps that Pirsig labels value traps, truth traps and muscle traps. Falling into these traps steers one away from Quality, the idea the book explores.

The more I read, the more I realized I actually understand most of what he writes about motorcycle maintenance, but not because I know anything about motorcycles – I don’t – still, I’ve been there and have intuitively come to similar conclusions. Doing the backend maintenance necessary to run a self-hosted blog or any website, I assume, is exactly like motorcycle maintenance.

A question I frequently ask myself, though, is why bother. There are so many blogging platforms out there where all I would have to do is write and put up my posts. Why go to the trouble to maintain the thing myself? Why deal with upgrades that don’t go as planned and potentially could screw up the database? Why mess with plugins that sometimes gum up the whole system? Why bother with themes that break?

I think the questions led me to the same issue Pirsig wrestles with. It has to do with Quality. With the relationship between the machine, the user and the process. Spending hours tinkering with the backend code and pieces of this blog are not really about the blog. It’s never even noticed by anyone reading it.

It’s about learning. It’s about growing.

Pirsig writes:

The real cycle you’re working on is a cycle called yourself. The machine that appears to be “out there” and the person that appears to be “in here” are not two separate things. They grow toward Quality or fall away from Quality together.

It all has to do with “living right.”

There is beauty and joy… life… to be discovered in doing things fully and completely. The more I approach life’s tasks with a quiet peaceful mind, the more fully, I think, I live.

Now I need to think of maintenance in the broader sense as it applies to this blog. Like Pirsig’s motorcycle, the blog is a machine with an engine that makes it go (the WordPress software), and it is a vehicle that takes me places, in this case the writing, which transports me into my head as I do it.

(I must admit I wish it would transport me physically to the Montana Rockies like Pirsig’s bike, but all good things must have their limits, I suppose.)

Maintaining (in both senses of the word, now) my blog suddenly seemed more important because I came to see that it is through this process that I can stay in tune with these lessons about right living. It is because of the hours spent working on it, that I have been able to relate so easily to what Pirsig writes.

Further, he reminds me that:

If you’re a sloppy thinker the six days of the week you aren’t working on your machine, what trap avoidances, what gimmicks, can make you all of a sudden sharp on the seventh?


But if you’re a sloppy thinker six days a week and you really try to be sharp on the seventh, then maybe the next six days aren’t going to be as sloppy as the preceding six.

And so because maintaining a blog is two things – keeping it running and writing, I’m back.

For the backend aspect of maintenance, I upgraded to 2.6.2, which is why some things are a little off while I work through the kinks.

Because maintaining the blog also means writing, I am reminded that through writing here, I ensure that my thinking is at its sharpest and that I approach closer to true Quality whenever I write and especially when I am sitting down to focus on a manuscript.

I never really thought of this silly blog as a way of thinking about life, but as I read Zen and the Art of Motorcycle Maintenance, it is because of this blog that I know and understand exactly what Pirsig is talking about in his book.

Older posts

© 2018 Coyote Mercury

Theme by Anders NorenUp ↑

%d bloggers like this: