WordPress Post Navigation Enlightenment
For some reason, I am fascinated by how post navigation is handled by WordPress and others CMSs. For example, what is the correct order of the “previous” and “next” post-navigation links? Is it different for single posts versus archive views? Should the arrow point right or left? And so forth. After pondering these questions periodically over the years, I’ve finally reached an understanding..
Post Navigation Enlightenment
While working on the latest Perishable Press redesign, it finally occurred to me the correct order of WordPress post navigation links.
For years I’ve been doing it backwards, with “previous” posts going toward the newer posts, and “next” posts going toward older posts. This technically is incorrect, as “next” should point to newer posts and “previous” to older. It’s all based on how the posts are organized chronologically. Because that’s how blog posts are organized. Like duh. I get it now.
The funny thing is, WordPress gets the order correct on single-post views, but not on archive-views. Here are the single-post nav tags:
<?php previous_post_link('← Previous Post'); ?> <?php next_post_link('Next Post →'); ?>
Notice the link text matches up with the tag name? Now look at the equivalent navigation tags for post-archive views:
<?php previous_posts_link('« Next Posts'); ?> <?php next_posts_link('Previous Posts »'); ?>
Here the link text is opposite the tag name. The navigation tags for single vs. archive posts are opposite one another in terms of directionality. They should be consistent, I think, would make the whole navigation order thing less confusing to users. Unless I am just confused again..