Archive

Archive for the ‘Tips’ Category

Removing dates from your articles, bad idea!

Everyone talks about “timeless” content. Some people call it “pillar posts”, the content that anchors your blog and cements your authority. I say, hogwash. There is no such thing as timeless content. If I stumble onto your blog post while looking for PHP code or WordPress optimization tips, and neither your article nor your URL has any indication whatsoever of when the article was written, I am going to assume the following about you:

1) You are trying to hide the fact that your best work is behind you.
2) You are cashing in on hits at the expense of the most updated advice.

Both of these I believe are short term strategies. Sooner or later people figure out that your article hasn’t been updated, and your authority suffers. Trust me, if you leave dates off your posts, this is happening to you and you probably don’t even realize it.

The fact is, advice and code changes over time. For example, over the years WordPress has introduced and deprecated dozens of functions. Google’s advice for webmasters has changed over time. If you found a website with some code you needed, or advice on how to optimize your site and the post had no date, how could you judge the code quality? You might be following old advice without realizing it and doing some damage to your search engine position or site loading speed. At the very least, copying and pasting old code into your site would be a time-wasting nuisance. I can’t even count how many articles I’ve found with no post date which contain broken links or outdated references to old WordPress plugins. I think that is more embarrassing than having the post date on the article and possibly having someone think your article is (gasp!) old.

Now I know some of you are howling: “I don’t run a news site, so the date of the post is irrelevant!” Or, “it’s a fact that people avoid content they think is old!”

I disagree. To the first point, I say that you are doing your visitors a favor by including the article date. It lets them immediately judge the relevancy of an article. As a web surfer, I appreciate that you respect my judgment enough to let me decide for myself if you are the best resource for a particular issue. It actually enhances your authority.

To the second point, only chickens who are afraid of losing visitors — or lazy bloggers who can’t be bothered to keep an article up to date — say things like that. It’s like the defense on a football team complaining about the other team’s offense. If you don’t like someone else scoring on you, do something about it!

Here’s one possible explanation:

One of the main problems with displaying dates on posts is that search engines and readers may associate the information on your older posts to be out of date. Readers may end up assuming it has lost its relevance.

So the solution is to completely mislead them by removing the date altogether, not write updated content?

Conclusion

What should you do?

  • Keep dates on your articles. Keep the time as well if you posted more than one article that day.
  • Update your “timeless” content regularly and use code to show the last modified time of either the article or the whole site. (Hint: I use a plugin for this.)
  • If you write an article that updates content on a previous article, link to that article from the original.
Advertisements
Categories: Tips, WordPress Tags: , ,

WordPress Optimization tips

December 1, 2011 Leave a comment

In the next few posts I’ll be offering some specific WordPress tips and tricks I’ve used to improve my site’s loading time and overall visitor experience.

Get a real host

Please do not set up a free blog on one of those services like WordPress.com or Blogger. As I’ve said previously, if you want to be taken seriously you need your own domain name.

I can hear the groans about how this very blog is on wordpress.com, but again, I don’t post often enough here to justify the expense and effort of an entire domain.

I strongly recommend FutureQuest as a web host. I have been using them for nearly 10 years and have never had a problem with downtime, bandwidth or file restrictions (that I didn’t cause on my own, anyway). This is not an affiliate link, I am simply interested in getting you the best hosting possible.

Unlike other do-it-all webhosts they do not do domain registration or other services that third parties can do better. They stick to web hosting. It is clear to me that they know what they are doing in this area.

The lowest shared hosting package offers 1 GB storage space, 35 GB bandwidth per month, secure FTP, MySQL/Apache/PHP and 15 email accounts. This is plenty for all but the largest sites and perfect for the WordPress setup we will be discussing in the next few posts; if you are just starting out it will be a while before you hit the wall. Price is $9.95 $8.95 per month, for peace of mind you cannot beat that. I’ll be offering FutureQuest-specific tips in future posts.

Get a theme framework

After years of slogging through free WordPress theme templates, I finally gave Genesis a go. Let me tell you, once you switch (and get over the learning curve) you will wonder how you got anything done before. Genesis makes theme modification so simple it is a joke. My last website took less than hour to set up from WordPress install to having a complete site online. This is also not an affiliate link. I want you to know that I am not recommending Genesis because I get a commission, I really do believe this framework is the best option for WordPress bloggers.

It is definitely worth the expense, and you can use their free themes if you don’t see a paid one that you like. I have seen my site loading time drop significantly since installing the Genesis framework. Once again, the peace of mind and increase in speed is worth the expense. I will be offering Genesis-specific tips in future posts.

Note that the folks who created Genesis have their own hosting solution, Synthesis. I have no experience with this but it looks pricey and doesn’t give you the same access to system files (ex: .htaccess) that regular shared hosting does.

I do not have experience with other theme frameworks, so I would love to hear about your experience with others like Thesis.

That’s it for now. In the next few posts we’ll go over recommended plugins and theme modifications.

Categories: Tips, WordPress Tags: , , ,

DMCA Complaint Template

January 13, 2011 2 comments

If you run a blog or website, you may run across someone stealing your content. In the blog world we call them “splogs” (spam blogs). They come in many forms, but usually it’s a site that takes your content (including images) from your RSS feed and reposts it as its own (with or without links to your site).

So I created a DMCA complaint form you can (re)use to put these people out of business.

DMCA Complaint Template (2003)

DMCA Complaint Template (2007)

It contains all the correct language (as it currently stands) for submitting DMCA complaints to U.S.-based web hosts. To find out if a given website is hosted in the United States, visit network-tools.com and enter the URL.

Just download the appropriate template and replace the highlighted sections.

I would go even further, depending on how pissed off I was — if the splog has ads, complaining to their ad networks will hit them financially as well.

Please do not leave comments asking me for specific advice on how to fill out the form. Google is your friend.

What do you do when you find your content somewhere else?

Some websites suggest that you contact the content thief first. From DevTopics:

If you discover a website has republished your original content without permission, the first step is to ask the splog to remove your content from its site. The best way to do this is to post a comment under your article on the splog for all its readers to see.

I disagree. The splogger had to deliberately scrape your content. It couldn’t possibly be an honest accident that deserves the respect of you asking nicely. The fact that it’s there at all means that we’re beyond the point of discussing this nicely.

If the person had approached you first and asked if they could use it, that would be the time to have a nice conversation with them.

Posting a comment is the worst thing you could do. It shows that you don’t really know how to contact the website and gives the splogger a respect they don’t deserve. Plus it looks like begging. In public.

The fact that your content is on someone else’s site is proof that the splogger deliberately disregarded your copyright. Serve ’em!

Categories: Tips Tags:

How I sped up my WordPress blog

January 18, 2010 4 comments

I thought I’d share some tips on how I cut down the loading time for my blog. These tips might help someone out there make their WordPress blog (or any website) run faster. So far, using these techniques, I’ve shaved about 2 seconds off the loading time (when cache is empty) and for repeat visitors, the load time is under 7 seconds. Testing performed using OctaGate SiteTimer. As usual, FireFox and Safari browsers were much faster than Internet Explorer.

Compact (“minify”) your CSS, PHP, JavaScript (JS) and HTML Files

Removing whitespace, unnecessary lines, and useless code from these files will shrink file size, improving download time of these files, at the expense of (possibly) making the files slightly less readable. This is the easiest thing you can do with these files. There are even online “compressors” where you can upload or cut and paste your code, and it will spit out the compressed version, but I wouldn’t use that unless you understand the output. Obviously, it helps greatly if you understand CSS, PHP and so on, so you can edit and compact the code yourself.

Remove comments and commented code from your active files and paste them into local backup files. I keep them on my hard drive, where I can make notes on what they’re for, in case I do eventually need them. Some CSS files even have whitespace (empty spaces) at the end of the line. If you press the “End” key, you can see where the true end-of-line is, and backspace over it to remove the wasted space.

And as I’ve found the hard way, WordPress will still process code inside comments, while leaving it commented out. So commented code (especially with PHP or database calls) will needlessly waste processor time which could be used to display your webpage. Weigh the benefits of keeping commented code in your blog’s PHP files versus removing it to decrease file size and save processor cycles. Again, I remove unused code, comment it, and save it on my hard drive if needed later.

Google has an excellent Firefox addon called PageSpeed which can show you where your CSS is inefficient or unused.

See 10 Tips For A Smaller CSS File for specific examples of how you can shrink your CSS file.

Many PHP-based themes for WordPress also use comments and whitespace in excess. Removing the whitespace and concatenating lines where possible will result in smaller file sizes.

Your blog may also benefit from conditional includes, which will have the double benefit of shrinking your file size and providing dynamic content. The process is identical to the process for creating external JS files: include a link to the PHP file, and in that PHP file, remove the opening and closing PHP tags. Make it conditional by using if statements.

Move CSS to the top, and JS to the bottom

Page load time will also benefit if you move CSS links to the top of the page, and JS links to the bottom. Anyway, this is what Yahoo recommends in their webpage optimization guidelines. JavaScript that isn’t essential for the operation of the page (ex: visitor tracking code) should be placed in the footer or at the bottom of the page, so the main content can load first. If you run WordPress, this is easy; there are a few “move Javascript to footer” plugins. I use JavaScript to Footer.

JavaScript should also be externalized, to shrink overall HTML file size. See Reduce The Size Of Your HEAD and scroll halfway down for instructions on how to create external JS files.

Remove unnecessary Plugins, and make the remaining ones conditional

Are you using 10, 20, 30+ plugins? Some plugins are processed every time a page is loaded, even if they don’t actually do anything on that page. For example, some plugins hook into the wp_head function to place CSS or JS links in your header, which will be loaded on every page even if the plugin isn’t being used on that page.

Can you remove them, or find a “rollup” plugin that can do the work of two or three of your existing plugins?

A popular class of plugins for WordPress are the ones that interact with Google Analytics. The one used on my blog is Google Analytics for WordPress. This plugin automatically inserts your Google tracking code into your posts and pages. But I can duplicate the effort by simply pasting in Google’s tracking code directly into footer.php of my theme, thereby saving time having the plugin do it. Just go to your Google Analytics account and get the tracking code, and paste it into the PHP file. Sure, I might have lost some of the functionality of the plugin, but all I really need is the basic reporting function of my Analytics account.

Another popular plugin is Feedburner FeedSmith. This plugin detects all of the ways your feeds can be accessed, and redirects them to your Feedburner feeds. That way, you can aggregate all your subscribers under the FB feed, making your subscriber count more accurate, and making sure all your subscribers are seeing the same content.

But all I had to do to get rid of this plugin is visit What is My WordPress Feed URL? and then edit my .htaccess file to redirect the built-in WP feeds to my FeedBurner feed.

Redirect 301 /blog/feed/ http://feeds.feedburner.com/MyFeedName
Redirect 301 /blog/feed/rss2/ http://feeds.feedburner.com/MyFeedName
Redirect 301 /blog/feed/rss/ http://feeds.feedburner.com/MyFeedName

and so on.

I got rid of the Random Posts plugin by using code I found on the ‘net that returns random posts using a WordPress function.

I am also using the Similar Posts plugin (from the same author) in my post footer, and if I didn’t mind changing it to random posts instead, I could use the above code as well, and remove two plugins.

Check your plugins and see if any of them don’t need to run all the time. For example, if you run a plugin that allows visitors to email or print a copy of a post (ex: WP-EMail, WP-Print), you probably don’t need them to run if the visitor isn’t on a post page. Make them conditional instead. This sometimes requires direct editing of the plugin code itself.

  1. Deactivate the plugin
  2. Click the “Edit” link to edit the plugin file itself
  3. Wrap the entire plugin in an if statement that checks the current page. Don’t forget the opening and closing braces “{ }”
  4. Save the file and reactivate the plugin.

This will be most successful with plugins that write CSS or JS links inside your head tag, because this hack will stop them from doing so, thereby decreasing load time for pages where the plugin isn’t necessary. If you got a fatal error when editing/reactivating, or your blog breaks, or the fix simply doesn’t work, you might need to search the plugin file (deactivate it again first) and look for the section where the CSS or JS file is written, and add the above code there instead.

Once editing is finished, the plugin will only run where we want it. See WordPress Conditional Tags for a complete listing of conditional tags. Remember, you’ll need to repeat these steps every time a plugin is updated, because the hack will be wiped out by the update. It will be easiest if you deactivate the plugin, update it, then hack it, before reactivating it. Also, for those plugins you need to call manually in your template, you’ll want to go through your template files and wrap the function calls in an ‘if (function_exists(plugin_name))’ statement, because you’ll be deactivating it a lot and you don’t want your blog to break every time you need to update a plugin. In fact, I recommend you do this for all plugin function calls, even the ones you won’t be editing, because someday you might need to deactivate one.

Certain plugins don’t need to be running around the clock, and can be safely deactivated and reactivated when needed. For example, I keep the following plugins deactivated until I need them:

  • WordPress Database Backup
  • WordPress Automatic Upgrade
  • Optimize DB
  • Maintenance Mode

Although it might actually be better to remove them completely and reinstall them when needed, since all plugins (even deactivated ones) are checked to see if they apply to a current page. Very inefficient on the part of WordPress, but that’s the way it is, and this is an article about speed and optimization after all.

Use compression

If using WordPress on a Unix-based host, try and use mod_deflate or mod_gzip. Some cheap webhosts won’t allow you to use it, however, because they are resource hogs. As an alternative, you might be able to use PHP-based compression (zlib). It depends on your webhost. See Compress your WordPress website for more.

Got additional suggestions? Post a comment with your thoughts.

Categories: Tips Tags: , , , ,