Paragraph-level commenting for WordPress

Digress.it is a Wordpress plugin enabling threaded, paragraph-specific discussion on posts and pages

The team from the Institute for the Future of the Book team have announced the release of digress.it, a completely overhauled version of the old Commentpress theme for WordPress, which allowed paragraph-level commenting. Digress.it is a plugin which Continue reading “Paragraph-level commenting for WordPress”

WordPress’ comment form tabindex no-no

Edit the tabindex values in your Wordpress theme to improve accessibility

I came across some particularly annoying tabindex behaviour on a web form I was using (or trying to use) the other day, which got me thinking more about how tabindex should be used.

Continue reading “WordPress’ comment form tabindex no-no”

Better pagination SEO with WordPress

Though SEO doesn’t get me all hot and bothered like it does some people, it is on my radar, as I think it should be for all web designers and developers.

One of the blogs I’ve recently subscribed to is SEOMoz, which I like both because it seems to be run by real professionals and thus avoids a lot of the sketchier, black/gray hattish SEO techniques, and also because it seems to have fairly good user comment discussions.

I was particularly interested by a recent “Whiteboard Friday” post in which SEOMoz CEO and co-founder Rand Fishkin discusses an SEO issue with pagination that had arisen with a client. While the blog post title, “A Farewell to Pagination” may be going a bit overboard, there were some definite good points, which basically revolved around the notion that extended pagination in which a website may have hundreds of pages going back years that are all organized in reverse chronological (or some other order) and accessed via pagination can be bad not just for navigation, but also for SEO.

Diving deeper and deeper into the site this way successively dilutes your link juice for the search engines that are crawling your site, potentially leading them to abandon including the deeper/older pages in their index, leading to their exclusion from search results. Fishkin discusses some navigation workarounds that are improvements both from an SEO and user experience point of view.

Applying this to WordPress, I wondered if there was a WordPress filter hook that would allow you to create a simple plugin that could appropriately add the rel="nofollow" attribute to your pagination anchor tags, so that pagination is still available to the user but won’t have the deleterious SEO effects. Turns out there isn’t, but there’s another easy, though less elegant, way to accomplish this, which is by defining a function in your WordPress templates’ functions.php file.

Just copy and paste the previous_posts_link and next_posts_link functions from wp-includes/link-template.php into your functions.php file, and make the following simple modification

function nofollow_next_posts_link($label='Next Page »', $max_page=0) {
	global $paged, $wp_query;
	if ( !$max_page ) {
		$max_page = $wp_query->max_num_pages;
	}
	if ( !$paged )
		$paged = 1;
	$nextpage = intval($paged) + 1;
	if ( (! is_single()) && (empty($paged) || $nextpage <= $max_page) ) {
		echo '<a rel="nofollow" href="';
		next_posts($max_page);
		echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>';
	}
}

function nofollow_previous_posts_link($label='« Previous Page') {
	global $paged;
	if ( (!is_single())	&& ($paged > 1) ) {
		echo '<a rel="nofollow" href="';
		previous_posts();
		echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>';
	}
}

With that done, simply use the new functions wherever in your template you want the nofollow functionality (e.g. in index.php). This is really only the beginning of a solution to this issue, as you’ll have to rework other aspects of your navigation if you really want to add rel="nofollow" to all your WordPress pagination.

Using WordPress as a CMS – Part 3

In the first two “wordpress as CMS” posts, I discussed the benefits of WordPress as compared with other free, open source CMSs and how to take advantage of recent WordPress improvements when using it as a CMS. In this installation, I’ll go into detail regarding a few plugins that are a “must” if you want to use WordPress as a CMS.

But first a word about plugin security. Unfortunately, WordPress plugins have a bit of a reputation for being insecure, due largely though not exclusively to the lack of proper sanitation of user input. Neglecting to check whether a user has entered malicious code into an input field into a form, for example, or tacked it onto the end of a query string can leave your server vulnerable to SQL injection and similar attacks. With that in mind, it’s prudent to check around for any security issues with a plugin before you install. If you have the PHP skills, you perhaps check the plugin yourself for any code that might leave your system open to being compromised.

But that aside, there are many secure and well-tested WordPress plugins, as well as many (perhaps most?) that do not introduce any user-interaction features beyond the WordPress core and thus aren’t even really candidates for opening up additional security holes. The following is a list of just a few.

Continue reading “Using WordPress as a CMS – Part 3”

Using WordPress as a CMS – Part 2

A principle of good software design is to balance the demand for new features with the necessity to maintain a high level of usability, and one sign of good software is that the interface remains uncluttered and intuitive as new functionality is added. For an example of how to do this the wrong way, look no further than Microsoft Word, which with each new release becomes more bloated and crammed with features that most people not only will never use but could never find out about even if they wanted to use them.

For examples of how to do this the right way, you could point to the web apps done by 37signals (e.g. Backpack), or to WordPress. Over the years, WordPress has continued to grow and to integrate new features, but has done a fairly good job of not allowing them to clutter core functionality. Following good usability principles like progressive disclosure means newbie users can jump right in and do what they want, while you don’t alienate advanced users by babying them with an impoverished interface.

A quick Google search for the terms “wordpress cms” reveals a plethora results, and the WordPress developers are aware that many people are using WordPress for much more than out of the box blogging. With that in mind, they continue to roll out functionality that makes it easier to use the platform as a content management system that can accomplish most of what you would want from your CMS.

Some of these features that you will find useful if not crucial to using WordPress as a CMS include:

  • the option to set a static or fixed homepage
    Prior to WordPress 2.1, you had to either hack around and create and upload a new homepage, or use a WordPress plugin to accomplish the same thing in a slightly more graceful way. Now, setting up a static homepage is as simple as going to the Settings > Reading panel and making the choice there. For more information, see Creating a Static Front Page
  • custom fields
    custom fields allow you to associate information with a post that goes beyond the parameters given to you by WordPress. Suppose, for instance, that you’re creating a WordPress site in which certain products for sale will be entered into the database as posts. Well, you’re going to want to store a bunch of particular information that will be associated with each product/post, including cost, availability, shipping, sizes, and so on.
    Using custom fields, you would type in a new key (say, “availability”) and then under the value, you would enter either “available” or “sold”. Then, when editing say, single.php (the wordpress template for single posts) you would access the data like so, from within the Loop:<?php echo get_post_meta($post->ID, 'availability', true); ?>If you wanted to make this data available outside of the Loop (e.g., in your sidebar), you would just type <?php global $availability; $availability = get_post_meta($post->ID, 'availability', true); ?>And then in sidebar.php, you would include <?php global $availability; echo $availability; ?>
  • page order
    Wordpress has only recently added the ability to define the order of your page manually, rather than using the options WordPress provides for wp_list_pages(), which are to sort by alphabetical order, or to sort by id. Though the functionality is new (and still a bit “janky” according to WordPress), it’s nice to know you won’t have to rely on third party plugins for such standard CMS features

In the next installment, I’ll discuss a couple more essential pieces for using WordPress as a CMS, including page templates, and also go further into third party plugins.

Using WordPress as a CMS – Part 1

For those searching for a free, feature-rich and easily-extensible Content Management System (CMS), WordPress is not to be overlooked. Not only is there a growing “literature” of blog posts and tutorials on how to use WordPress as a CMS, but the core developers seem to recognize WordPress’s suitability for this role and are continually providing further enhancements that make it easier to use WordPress in this way. And if there is some CMS-like functionality you need from WordPress but can’t get it with a plain ol’ vanilla install, there is a wealth of well-coded and reliable plugins among which you are likely to find a solution.

One powerful reason to make wordpress your CMS of choice is its ease of use. While Joomla!, Drupal and the like are all excellent CMSs, none of them prioritize simplicity to the same degree that WordPress does. This isn’t as much of a criticism as it sounds like–there is an inevitable trade-off between the available features and power of a piece of software and its out-of-the-box, so-easy-your-dog-could-do-it usability. WordPress is a platform for the unwashed blogging masses, while Joomla! and Drupal are fully-fledged CMSs that compare favourably with any enterprise-level solution you’d pay thousands of dollars for. Each understands its user-base and its niche and guides software development accordingly.

But in addition to being suitable for the masses, WordPress is a great choice if you’re doing a website for a client who either is a) not as comfortable with new technology; or b) has little time and is someone for whom the need to learn how to navigate a complicated CMS admin panel will be a significant barrier to actually using it. You can easily teach someone the WordPress “basics and then some” in an hour, which means satisfaction both for the client and for you (imagine all the support email questions you *won’t* be getting!).

That’s it for the first part of this mini-series. In the next post, I’ll dig in to some more technical issues and look at how recent advancements in the WordPress platform are increasingly making it a viable CMS solution.