{"id":33105,"date":"2010-06-03T10:00:08","date_gmt":"2010-06-03T14:00:08","guid":{"rendered":"http:\/\/wpmu.org\/?p=33105"},"modified":"2010-06-02T23:30:17","modified_gmt":"2010-06-03T03:30:17","slug":"simple-guide-to-creating-custom-author-templates-with-wordpress-3-0","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/simple-guide-to-creating-custom-author-templates-with-wordpress-3-0\/","title":{"rendered":"Simple Guide to Creating Custom Author Templates With WordPress 3.0"},"content":{"rendered":"<p>Custom author templates can be a great enhancement to a multi-author blog where you want to implement unique styles for one or more blog authors.<\/p>\n<p>WordPress 3.0 makes customizing author templates easier than ever.\u00a0It&#8217;s now similar to the way you might create a unique category template: ie.<i> category-news.php<\/i> and it&#8217;s new to 3.0.<\/p>\n<h2>How to include a custom author template file:<\/h2>\n<p>WordPress first will look for one of the following:<br \/>\n<b>author-{nicename}.php<\/b><br \/>\n<b>author-{id}.php<\/b><\/p>\n<p>If neither of these are present, it will then look for <i>author.php<\/i> followed by <i>archive.php<\/i> and then <i>index.php<\/i>.<\/p>\n<h4>Step 1: Create the author-{nicename}.php file.<\/h4>\n<p>The easiest way is to copy the archive.php file and then add or change whatever you want to in that file. Save it as an author template file, ie.:<\/p>\n<p><b>author-walter.php<\/b><\/p>\n<h4>Step 2: Upload the file to your theme&#8217;s folder.<\/h4>\n<p>Now you can check out your custom template by visiting the author&#8217;s archive you customized. For example:<\/p>\n<p><b>http:\/\/yourdomain.com\/author\/walter\/<\/b><\/p>\n<p>This is an example of a custom author template page added to the BuddyPress default theme:<\/p>\n<p><a rel=\"lightbox[33105]\" class=\"blog-thumbnail\" href=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2010\/06\/authortemplate.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-33114\" title=\"authortemplate\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2010\/06\/authortemplate.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"640\" height=\"328\" \/><\/a><\/p>\n<p>The above example uses the basic <i>archive.php<\/i> template for BuddyPress with an added tag to include Biographical Info for the user at the top before the posts. Include this snippet in your <i>archive.php<\/i> file to show author info:<\/p>\n<pre>&lt;?php\r\nif(isset($_GET['author_name'])) :\r\n\/\/ NOTE: 2.0 bug requires: get_userdatabylogin(get_the_author_login());\r\n$curauth = get_userdatabylogin($author_name);\r\nelse :\r\n$curauth = get_userdata(intval($author));\r\nendif;\r\n?&gt;<\/pre>\n<div id=\"authorbio\">\n<h4>Walter&#8217;s Bio:<\/h4>\n<pre>&lt;?php echo $curauth-&gt;user_description; ?&gt;<\/pre>\n<\/div>\n<p>How you customize the template is up to you. You can add particular CSS classes, unique backgrounds, a quick bio at the top of the page, custom author information, or anything you want to make the page different from your default archives.<\/p>\n<h4>Further Details and More Information<\/h4>\n<p>Please note that the custom author templates will only work with WordPress 3.0 and will not be applicable to earlier versions. You can find more detailed information about how to create unique author templates, tags you can include, and a sample template in the WordPress codex section on <a href=\"http:\/\/codex.wordpress.org\/Author_Templates\" rel=\"noopener\" target=\"_blank\">Author Templates<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Custom author templates can be a great enhancement to a multi-author blog where you want to implement unique styles for one or more blog authors. WordPress 3.0 makes customizing author templates easier than ever.\u00a0It&#8217;s now similar to the way you might create a unique category template: ie. category-news.php and it&#8217;s new to 3.0. How to [&hellip;]<\/p>\n","protected":false},"author":4099,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[1,557,235,263],"tags":[640,4993],"tutorials_categories":[],"class_list":["post-33105","post","type-post","status-publish","format-standard","hentry","category-news-community","category-development","category-misc","category-tutorials","tag-authors","tag-templates"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/33105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/4099"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=33105"}],"version-history":[{"count":4,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/33105\/revisions"}],"predecessor-version":[{"id":182997,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/33105\/revisions\/182997"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=33105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=33105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=33105"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=33105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}