WordPress Shortlinks: How to Override the WP-Stats Plugin Override

Wordpress WP-Stats Shortlink Override

If you’re like me, you are addicted to stats. It’s probably not altogether a healthy addiction, but it’s there and we have to cope with it.

If you’re like me, you also dig shortcuts. Anything to make something easier, faster or even better, both–and it’s a lovely thing.

So if you’re like me, you probably are running WordPress 3.1+ and the WP-Stats plugin. Oh sure, I use other stat programs, but again–I’m addicted. It’s a neat, handy, quick way of getting stats and even better, it’s free. And if you use shortlinks, i.e. this post can be both “http://www.needcoffee.com/2011/04/16/wp-stats-shortlink-override/” and “http://needcoffee.com/?p=19837” then the fact you can snag the shortlink from the admin bar when you’re on a single page of the site…that is awesome.

However.

(more…)

When the WordPress Similar Posts Plugin Attacks!

Similar Posts screen snippet

Okay, so I ran into a problem recently with the Similar Posts plugin that Rob Marsh put together. I guess he’s AWOL due to health-related issues per his blog and I hope he’s just not blogging as opposed to, you know, actually quite ill or something.

Similar Posts is the best plugin I’ve found for providing…well, what the title says: Similar Posts. Putting those related posts down at the bottom of each of my posts, both so you can find something else to read and also because it provides nice links back to other parts of the blog for search engines. Every other one I’ve tried just hogs the CPU every single time you turn around. But Similar Posts, with its caching bit, works fine.

(more…)

MySQL Server Has Gone Away – Why Doesn’t It Love Me Anymore?

If You Hadn't Gone Away

That’s right–maybe your MySQL server just isn’t that into you. Or maybe you’ve got a bit of a setup issue.

Here’s the shot: first up, it’s a good idea to keep an eye on your error logs. I reminded myself of this when I saw my MySQL server dying every so often (the MYSQLD process for people who care) and went to go check my error logs. In fact, I used to have a window logged into my server with tail -f error_log running so I can see errors in realtime. I’ve started doing that again.

Basically you go to your server’s statistics/logs directory at a prompt (this is Linux…no idea if Windows is different) and type “tail -f error_log.” That will just scroll the errors. If you just want to read the latest errors, you leave off the -f.

If you don’t have your own server and can only download the log file, I suggest doing it once a week. Set yourself a reminder in Outlook or whatever you use.

(more…)

How to Selectively Add Captions to Images in WordPress 2.7

Tips I Realized While Typing This Up: This was written and is being used on WordPress 2.7. It might work on 2.6x, but I didn’t try that. So be aware. Also, this works for me because I don’t use the visual editor when writing up a post. I see straight HTML. If you try this and it’s wonky, let me know and I’ll tinker with it if I have time.

Okay. When I moved to WordPress 2.6 (or whatever iteration of that I moved to at the time), the automatic on captions for images annoyed the crap out of me. For some obvious reasons:

1. Maybe I don’t want captions on all my images. We’re going to use my recent Glengarry Glen Ross DVD review that I ported from the old site to WordPress as an example because that’s where I realized captions could come in handy. But take a look at the top of the review.

(more…)

Quick and Dirty Access Log Fun: What Do I Need to Optimize First?

Wordpress W

So this I’ve repurposed from where it was languishing on my personal blog, which has fallen into disrepair since I started putting more and more of my stuff onto Needcoffee, just like I urge everybody on our staff to do–because I’m a total nutjob. I remembered this post after HTQ4 had asked me a question about his logs and how to deal with them. Anyway, when I tried to look at my access logs, there was a boatload of crap in there and I couldn’t even answer the question: what are the hogs that I need to deal with–what can I change to keep the overhead of the site down?

The access log I was getting looked like this:

x.x.x.x – – [fusion_builder_container hundred_percent=”yes” overflow=”visible”][fusion_builder_row][fusion_builder_column type=”1_1″ background_position=”left top” background_color=”” border_size=”” border_color=”” border_style=”solid” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”no” center_content=”no” min_height=”none”][26/Apr/2007:00:36:50 -0700] “GET /wp-content/plugins/podpress/podpress_js.php HTTP/1.1” 200 2311 “http://www.needcoffee.com/2006/03/08/power-rangers-dino-thunder-vol-3-dvd-review/” “Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3”

Now, barring for a moment that someone is actually viewing a Power Rangers review and we must find them and stop them from breeding, imagine 10MB of that. That’s how much I’ve got for a full day’s access log, and that’s after I’ve been working for a few days to optimize my robots.txt file.

(more…)

Quick and Dirty Amazon Links in WordPress

Sadly, there is no good Amazon plugin in WordPress that makes me happy. And you know what I’m talking about: a plugin where you never have to leave WordPress. You can look up an item, get the ASIN, link it up–all in the same window. The last Amazon plugin I used was cumbersome and its search was wacked: you could hardly ever find what you were looking for, even if it was a tremendously popular item.

So basically I’ve created three Amazon-related buttons in my quicktags to do the work. I still have to find the ASIN of the item I want (if I’m linking to an item) but that’s workable. If somebody had a Greasemonkey script that would make the ASIN show up in a search without making me open each item, that would be even better. But one of these days. Anyway, these three buttons do this:

1. Link to a specific item using slightly customizable anchor text.
2. Link to a subject rather than an item using slightly customizable anchor text.
3. Link any text to a specific item.

As always, remember that I’m a writer. I was telling someone the other day that I’m the coding equivalent of the Midnighter. There’s no art to what I do, I smack things with code until they start working. So your mileage may vary–keep a backup of all your files and a fire extinguisher handy.

(more…)