Coyote Mercury

words, birds and whatever else by James Brush

Tag: plugins

Geeking Out for Greyhounds (or, My First and Probably Only WordPress Plugin)

Each week, when I do Weekend Hound Blogging, I insert the following at the end of the post:

Want to make a fast friend by saving a greyhound in Central Texas? Check these pups out. Or go here to find a greyhound near you. You can also go here to find out why greyhounds are running for their lives.

If you have dogs who need proven leadership, go here to find a cat.

This requires me to find an old post, copy and then paste the text into the new post. Surely, thought I, there must be an easier way, which got me thinking about trying to create a plugin to do that for me.

I studied some of the simpler in-post plugins I already use and tried to decipher the PHP.

I read “Writing a Plugin”, studied the “Plugin API” page and “Plugin API/Hooks”on the WordPress site, as well as “How to Write a Simple WordPress Plugin” on Asymptomatic. Then, I started putting together a PHP file, tinkering and playing until I eventually had a plugin that allows me to type:

[ saveagrey ]

(without the spaces) and have this appear:

Want to make a fast friend by saving a greyhound in Central Texas? Check these pups out. Or go here to find a greyhound near you. You can also go here to find out why greyhounds are running for their lives.

If you have dogs who need proven leadership, go here to find a cat.

The cool thing is that it can be easily changed so that the text and links go anywhere or say anything, which might make this useful for anyone who occasionally wants some message at the end of certain posts such as vote for so-and-so at the end of all political posts or something to that effect.

This little exercise was a lot of fun. I really enjoyed trying to decipher the PHP since I know nothing about that language. Ultimately it became something of a puzzle that could only be solved through logic. When I figured out the solutions to the problems I encountered, I was rewarded with something that will save me time and possibly be of use to anyone who uses WordPress and wants to help save retired racing greyhounds.

So, there it is. My first plugin: Save a Greyhound (click to go to the download page)

Photoblogging on WordPress

The picture is of the business school at the University of Texas at Austin. Why?

Because it’s so easy to photoblog now.

On thing that’s always been a bit annoying about WordPress is that it’s not the friendliest blogging tool when you want to use images. Typically, I’ve had to resize them in a photoeditor, then upload them to my hosting service, then import the URLs into the blog.

But, I’ve found and just installed Photopress, a very cool plug-in. I had to do some CSS tweaking to get it to work with my layout, but now when you click the photo tab on my blog (or click one of the photos) it will take you to the photo page where all the images I use (and any others that I don’t blog, but want to share) can be seen.

Best of all, uploading photos is now a one-step process.

Update: WordPress now supports proper photoblogging. Yay WordPress.

© 2017 Coyote Mercury

Theme by Anders NorenUp ↑

%d bloggers like this: