Preview short URL’s in comments

Yesterday Keith Dsouza wrote in Weblog Tools Collection about the problem with short url in comments which are used by spammers to try to get their comments approved.

The problem with short urls is that in order to know where the link points you have to click on it with the risk of being sent to a malware site or something else. Or you can use another web service to expand the URL and check the destination but you have to open another browser tab, copy the URL from the comment and paste it into the other tab.

Continue reading

Default Post thumbnails plugin

Featured

With the support for post thumbnails in WordPress 2.9 you can now display a thumbnail image for each post in your site, depending on the theme you are using and if you enabled support for post thumbnails for it.

But if your site already has hundreds of posts, adding a thumbnail image for each one will be a lot of work even if you only want the same image for each old post.

This plugin allows you to specify a default post thumbnail for posts that doesn’t have a thumbnail set.

This plugin requires that you have enabled support for post thumbnails in your theme (you can enable it by adding these 2 lines in your theme functions.php file).

if ( function_exists(‘add_theme_support’) ) {
add_theme_support(‘post-thumbnails’); }

You can select the thumbnail from the images already uploaded to your media library.

You can see more screenshots of this plugin, how to use it and the download link in the Default Post Thumbnails page

Post thumbnails and default images

In my previous post about post thumbnails with posts excerpts I shared code to display the first image of your post as a thumbnail in your main page and it displayed a default image if the post didn’t have any images in it.

Now that WordPress 2.9 was released we can use new functions to display the post image as a thumbnail. This feature is only available if it is enabled specifically in the theme, so to enable it all you have to do is add this 2 lines to the functions.php file of your theme.

if ( function_exists(‘add_theme_support’) )
add_theme_support(‘post-thumbnails’);

This will enable the post thumbnail functionality and add a new box in your new post pages to set the post thumbnail

post_thumbnail_box

post_thumbnail_box2

To set an image as thumbnail you upload it like any other image or select it from your media library and at the bottom you will see the text “Use as thumbnail”, click on it and that’s it.

post_thumbnail_3

Now, to display the thumbnail in your theme you have to use the function the_post_thumbnail(),  the basic usage should be :


if ( current_theme_supports( 'post-thumbnails' ) )
the_post_thumbnail(array(100,100));

Which is pretty simple, and integrated  into the code we have from the previous post about thumbnails should look like this:


if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {
the_post_thumbnail(array(100,100));
} else {
postimage(100,75,'image for: '.get_the_title(),'image');
}

WordPress checklist before going live

Changing this site backend to WordPress made me think again the list of things to check before flipping the switch to “Live”. Some are obvious, some are

Templates

404.php
If your theme doesn’t have a 404.php template it will redirect to the main page, and the visitor will wonder why the page he was expecting to see is replaced with the main page of the site.

About page
Don’t forget to replace the default page text created by WordPress for the about page, you can find over a million pages with the exact same text.

CSS

Printer friendly pages or CSS
Try printing some pages of your site and verify that the result is readable. Consider creating an alternate CSS if necessary

WordPress Standard CSS classes
Don’t forget to include the standard CSS classes from WordPress (.alignleft, .alignright, .aligncenter, .wp‐caption, .cat‐item, .currentcat, etc…)

Browser compatibility
The goal is to give the visitor the best browsing experience possible, but we have to keep in mind that not all browsers are the same.  Test in different browsers, but remember that every browser has different grades of support for standards.

RSS

Verify that the RSS is reachable or redirects to Feedburner if you are going to use Feedburner.

robots.txt

Make sure robots.txt file is free from errors that can keep the search engines from indexing your site. And the pages that are not intended to be listed in search results should be disallowed in robots.txt. The easiest way to handle this without having to read a lot is with a plugin (for example: Robots.txt WordPress Plugin ).

Sitemap

Site maps are often neglected. Whenever pages are added or removed from your site make sure the site map gets updated as well. Again the easiest way to manage this is with a plugin (for example: Google XML Sitemaps)

Forms

If you provide a contact form that deliver messages to your email box, verify that you receive the email. Also if you use a form to gather email addresses to build a list for a newsletter don’t forget to verify that the email is sent and the information is saved to a database with the correct information from the form.

Site search

This is an important element of on-site usability. Verify that the search functionality works as expected and the template renders the results. If it doesn’t work it does more harm than good. You can use the search functionality build into WordPress or implement a 3rd party service like Google Custom Search.

Redirects

If you are migrating an old site or a site from another domain don’t forget to set redirects (using .htaccess or with a plugin) and verify that the redirects work by checking a couple pages or posts using the old URL and verifying that you end at the right (new) URL.

Statistics scripts

Check that the script needed to track visits is included on each page, is irritating when you lose statistics because you forgot to include the tracker script.

In the WordPress Codex about Theme Development Checklist are more things to consider before declaring a site ready to go live, please note that I didn’t finished, because you still need to check if the HTML code is valid, add tracking & statistics code, load times optimization, etc…

And I’m sure everyone has a similar list, please add a comment and share the things you check.