WordPress plugins suck/rule.

Those who have had the pleasure of sitting through a discovery or web visioneering meeting with Tilted Chair’s Creative/Interactive Director Jamie Rodriguez are probably tired of hearing it, but the truth is, WordPress is made great—and terrible—by its plugin library.

Plugins are powerful

They can help make really complex functionality possible within the WordPress environment.

At the same time, novice WordPress warriors go plugin-crazy downloading a new plugin for every simple piece of functionality desired. And, every added plugin represents a potential security or functionality vulnerability.

Not to mention, the more plugins you add, the more upgrade promos you have to deal with, which many times result in the top of your WordPress dashboard looking like this:

Messy looking WordPress dashboard

Now, you could clean that mess up…by adding another plugin! Aye yi yi…

Instead, one of the measures of an elegant and professional WordPress website build is just how few plugins must be used to achieve desired functionality. Or as we in Tilted Chair’s interactive department like to say: plugins only as a last resort.

Author pages

One commonly requested piece of functionality is author pages, i.e., a dedicated archive page for each blog author. This objective often leads users to download and install a WordPress plugin just to accomplish this simple task, something like this. (And no offense is intended to the creators of said plugin; it has excellent reviews, and seems to offer some advanced functionality, which many WordPress website owners might find useful.)

Those—like us here at Tilted Chair—who are loathe to install yet another plugin, boy do we have some good news for you: author pages are native to WordPress, right out of the box!

Template hierarchy

By default, author pages are automatically generated by the built-in files that already exist in most WordPress websites.

Referring to the WordPress documentation, you’ll see a template called archive.php. Nearly all WordPress installations include this template in their file structure natively. However, as you can see, the archive.php template is only fourth in the author template hierarchy.

Meaning, if one were to add any one of the other three templates in addition to the archive.php file, WordPress would never get to the archive.php file, instead opting to render any one of the three templates that precede the archive.php file hierarchically.

Which template to choose

That depends.

If you’re already using the archive.php file for other purposes—say, for instance, to render blog posts in a specific tag or category taxonomy—then our advice would be to create an author.php file in addition to the archive.php file.

This would leave the archive.php file to render taxonomical archives, while allowing the author.php file to render just author archives.

Here’s a link to a Tilted Chair-created author page, and here’s what that page ends up looking like:

Example of a WordPress author archive page.

Code for the author.php file

We’re not going to give you the whole file, but here are the relevant pieces:

Author name

php get_the_author_meta( 'display_name' );

This php command pulls whatever is selected from the “Display name publicly as…” dropdown selector in the author’s WordPress user profile:

Author bio

php get_the_author_meta( 'description' );

This command renders whatever text is populated in the “Biographical Info” text area in the author’s WordPress user profile:

Author avatar

This is another commonly requested element, and it’s just as easy as the others. Here’s the code:

echo get_avatar( get_the_author_meta( 'ID' ) , 96 );

There are other fields and data that can be pulled from an author’s profile, but these are definitely two of the big ones. The complete list of values can be found in the WordPress Codex.

Linking to the WordPress author page

Couldn’t be simpler:

php echo get_the_author_link();

That’s right: this one line generates both the markup (HTML), link destination, and link label. God bless you, WordPress.

So there ya go: you can have your author page and eat it, too.

Save the plugins for the toaster!

Leave a Reply

Your email address will not be published. Required fields are marked *