How do I create author pages?
-
Before anyone asks, yes, I read the relevant forum threads on author templates, etc. I’m still clueless.
I have a call to
list_authorsin my sidebar. When I click on one of the authors, I get a 404 error.I’m using WordPRess 2.0. I have an
author.phptemplate file. My permalink structure is/archive/%post_id%. The author pages should be found atarchive/%author%, but they aren’t.My main page is here:
http://alesrarus.funkydung.com
One of the author pages I’d like to create:
http://alesrarus.funkydung.com/archive/author/funky-dung/
The
author.phpfile I’m trying to use:<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<!-- This sets the $curauth variable -->
<?php
if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
endif;
?><h2>Posts by <?php echo $curauth->nickname; ?>:</h2><ul>
<!-- The Loop -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?><li>
<a>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
<?php the_title(); ?></a>,
<?php the_time(‘d M Y’); ?> in <?php the_category(‘&’);?>
<?php endwhile; else: ?>
<?php _e(‘No posts by this author.’); ?>
<?php endif; ?>
<!– End Loop –>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
`
-
Maybe it is here:
Author_Templates#Custom_Author_Templatein particular this:
2.0 bug requires
get_userdatabylogin(get_the_author_login()));That change had no effect.
Is there some step that I have missed? Is there a step-by-step tutorial somewhere on how to set up author pages? I didn’t see one in the codex or the forums (at least not one I could comprehend in my WP newbiness).
I’m not experiencing your problem on 2.0 or 2.1 on a localhost xampp system nor on a linux host at 2.1.
I used your exact code (more about that later) and your Permalink settings.
Here’s what I did:
I put awp_list_authors()tag in mythemes/default/sidebar.phpfile. Then created athemes/default/author.phpfile with your code. Clicked on an author’s nickname in my sidebar and got a http://www.sample.com/archives/author/username type url in my browser with their posts displayed.Take a look at this for a better display of your author’s posts Author_Templates#Listing_Entries_via_The_Loop.
Not too sure what to tell you. Maybe start with an empty .htaccess file and Update Your Permalink Structure.
Is there any significance to the choice of
wp_list_authors()over ‘list_authors()?I wondered if maybe by .htaccess file was screwed up. Hopefully I wouldn't be beaten with a LART (aka Clue Bat or Clue by 4) if I said that setting that file up properly is opaque to me. ;) Here's my .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect FeedBurner to your own Feed
RewriteBase /
RewriteRule ^feedburner_733196/?$ /feed/ [R,L]
RewriteCond %{HTTP_USER_AGENT} ^FeedBurner.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# These Rules redirect all feed Traffic to FeedBurner
RewriteBase /
RewriteCond %{QUERY_STRING} ^feed=(feed|rdf|rss|rss2|atom)$
RewriteRule ^(.*)$ http://feeds.feedburner.com/AlesRarus [R,L]
RewriteRule ^(feed|rdf|rss|rss2|atom)/?(feed|rdf|rss|rss2|atom)?/?$ http://feeds.feedburner.com/AlesRarus [R,L]
RewriteRule ^wp-(feed|rdf|rss|rss2|atom).php http://feeds.feedburner.com/AlesRarus [R,L]
# These are the standard WordPress Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule># END WordPress’
Do I need to add/modify anything?
BTW, thanks for the help so far. It’s nice to find a forum in which a newbie isn’t dismissed as a pest. 😉
wp_list_authors()could be described as a wrapper tolist_authors. The difference is that one passes all the parameters as one string and the other passes each parameter separated by commas.Can’t address your .htaccess I was just suggesting start with an empty .htaccess, let WordPress generate a new set of rules then try that. I’m LART also. 😉
I’ve discovered that my archives and category pages give me 404 errors as well. I guess it’s time to figure out how htaccess works…
The topic ‘How do I create author pages?’ is closed to new replies.